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:
parent
9a815b356b
commit
1ad9781d68
1 changed files with 6 additions and 0 deletions
|
@ -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")
|
||||||
|
|
Loading…
Reference in a new issue