ソースを参照

add SpiderMonkey test runner

tags/0.4.0
Jan Lehnardt 14年前
コミット
671f8eaa52
1個のファイルの変更27行の追加0行の削除
  1. +27
    -0
      test/mustache_spec.rb

+ 27
- 0
test/mustache_spec.rb ファイルの表示

@@ -22,6 +22,7 @@ def load_test(dir, name, partial=false)
end
end

JS_PATH = `which js`.strip()
JSC_PATH = "/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc"
RHINO_JAR = "org.mozilla.javascript.tools.shell.Main"

@@ -173,6 +174,27 @@ describe "mustache" do
end
end

context "running in SpiderMonkey (Mozilla, Firefox)" do
p JS_PATH
if !JS_PATH.empty?
before(:each) do
@run_js = :run_js_js
end

before(:all) do
puts "\nTesting mustache.js in SpiderMonkey:\n"
end

after(:all) do
puts "\nDone\n"
end

it_should_behave_like "Mustache rendering"
else
puts "\nSkipping tests in SpiderMonkey (js not found)\n"
end
end

context "running in JavaScriptCore (WebKit, Safari)" do
if File.exists?(JSC_PATH)
before(:each) do
@@ -231,6 +253,11 @@ describe "mustache" do
send(runner, js)
end

def run_js_js(js)
File.open("runner.js", 'w') {|f| f << js}
`#{JS_PATH} runner.js`
end

def run_js_jsc(js)
File.open("runner.js", 'w') {|f| f << js}
`#{JSC_PATH} runner.js`


読み込み中…
キャンセル
保存