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

Test eval syntax errors

This commit is contained in:
Joshua Peek 2014-12-06 12:26:08 -08:00
parent 13053caed1
commit 0dcad9a755

View file

@ -152,12 +152,18 @@ class TestExecJS < Test
assert ExecJS.exec("function foo() {\n#{body}\n};\nreturn true") assert ExecJS.exec("function foo() {\n#{body}\n};\nreturn true")
end end
def test_syntax_error def test_exec_syntax_error
assert_raises ExecJS::RuntimeError do assert_raises ExecJS::RuntimeError do
ExecJS.exec(")") ExecJS.exec(")")
end end
end end
def test_eval_syntax_error
assert_raises ExecJS::RuntimeError do
ExecJS.eval(")")
end
end
def test_thrown_exception def test_thrown_exception
assert_raises ExecJS::ProgramError do assert_raises ExecJS::ProgramError do
ExecJS.exec("throw 'hello'") ExecJS.exec("throw 'hello'")