sjbarag / brs

An interpreter for the BrightScript language that runs on non-Roku platforms.
MIT License
113 stars 43 forks source link

Environment for mocked component is wrong #574

Open lkipke opened 3 years ago

lkipke commented 3 years ago

Example:

In testcase.test.brs:

_brs_.mockComponent("DependencyComponent", {
    helloWorld: function()
        return m.top.subtype()
    end function
})

In MyComponent.brs:

dep = createObject("roSGNode", "dependencyComponent")
print dep.helloWorld() ' => "MyComponent"

It seems like the environment isn't getting seeded correctly for a member method.

Vasya-M commented 3 years ago

just want to add a note that brs has the same behavior if use dep.callFunc("helloWorld").