1
0
Fork 0
mirror of https://github.com/rails/execjs synced 2023-03-27 23:21:20 -04:00

Ensure commonjs vars are undefined

This commit is contained in:
Joshua Peek 2011-09-12 16:56:27 -05:00
parent 9a815b356b
commit 1ad9781d68

View file

@ -90,6 +90,12 @@ class TestRuntime < Test::Unit::TestCase
assert_equal true, @runtime.exec("return this === (function() {return this})()") assert_equal true, @runtime.exec("return this === (function() {return this})()")
end end
def test_commonjs_vars_are_undefined
assert @runtime.eval("typeof module == 'undefined'")
assert @runtime.eval("typeof exports == 'undefined'")
assert @runtime.eval("typeof require == 'undefined'")
end
def test_compile_large_scripts def test_compile_large_scripts
body = "var foo = 'bar';\n" * 100_000 body = "var foo = 'bar';\n" * 100_000
assert @runtime.exec("function foo() {\n#{body}\n};\nreturn true") assert @runtime.exec("function foo() {\n#{body}\n};\nreturn true")