test/johnson/runtime_test.rb in jbarnette-johnson-1.0.0.20081126120511 vs test/johnson/runtime_test.rb in jbarnette-johnson-1.0.0.20090127202936

- old
+ new

@@ -1,6 +1,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), "/../helper")) +require 'tempfile' module Johnson class RuntimeTest < Johnson::TestCase def test_default_delegate_is_spidermonkey assert_equal(Johnson::SpiderMonkey::Runtime, @runtime.delegate.class) @@ -10,9 +11,15 @@ assert_nil(@runtime.evaluate(nil)) end def test_js_eval assert_equal(1, @runtime.evaluate('eval("1");')) + end + + def test_shebang_removal + t = Tempfile.new("johnson_shebang") + t.open { |tf| tf.write "#!/usr/bin/johnson\ntrue;" } + assert Johnson.load(t.path) end def test_js_throws_compile_errors assert_raises(Johnson::Error) { @runtime.evaluate("var js_lambda = function(x) { return x ** 2; }")