1
0
Fork 0
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:
Sam Stephenson 2011-02-09 00:20:27 -06:00
parent 8e80f8fb8d
commit 9e8f986631

View file

@ -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(")")