diff options
Diffstat (limited to 'tests/02_runtime/02_this')
-rw-r--r-- | tests/02_runtime/02_this | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/tests/02_runtime/02_this b/tests/02_runtime/02_this deleted file mode 100644 index d8e85d2..0000000 --- a/tests/02_runtime/02_this +++ /dev/null @@ -1,50 +0,0 @@ -The "this" object accesses the current function context. - --- Expect stdout -- -true -true --- End -- - --- Testcase -- -{% - // Functions not invoked on objects have no this context - function test() { - return (this === null); - } - - // When invoked, "this" will point to the object containing the function - let o; - o = { - test: function() { - return (this === o); - } - }; - - print(test(), "\n"); - print(o.test(), "\n"); -%} --- End -- - -Test that the context is properly restored if function call arguments are -dot or bracket expressions as well. - --- Expect stdout -- -true -true --- End -- - --- Testcase -- -{% - let o; - o = { - test: function() { - return (this === o); - } - }; - - let dummy = { foo: true, bar: false }; - - print(o.test(dummy.foo, dummy.bar), "\n"); - print(o.test(dummy.foo, o.test(dummy.foo, dummy.bar)), "\n"); -%} --- End -- |