mirror of
https://github.com/rails/execjs
synced 2023-03-27 23:21:20 -04:00
Add a test for the value of 'this' in eval and exec
This commit is contained in:
parent
8e80f8fb8d
commit
9e8f986631
1 changed files with 5 additions and 0 deletions
|
@ -27,6 +27,11 @@ module TestRuntime
|
|||
assert_equal({"a"=>1,"b"=>2}, @runtime.eval("{a:1,b:2}"))
|
||||
end
|
||||
|
||||
def test_this_is_global_scope
|
||||
assert_equal true, @runtime.eval("this === (function() {return this})()")
|
||||
assert_equal true, @runtime.exec("return this === (function() {return this})()")
|
||||
end
|
||||
|
||||
def test_syntax_error
|
||||
assert_raise ExecJS::RuntimeError do
|
||||
@runtime.exec(")")
|
||||
|
|
Loading…
Add table
Reference in a new issue