mirror of
https://github.com/rails/execjs
synced 2023-03-27 23:21:20 -04:00
20 lines
494 B
Ruby
20 lines
494 B
Ruby
require "execjs"
|
|
require "test/unit"
|
|
|
|
class TestExecJS < Test::Unit::TestCase
|
|
def test_exec
|
|
assert_equal true, ExecJS.exec("return true")
|
|
end
|
|
|
|
def test_eval
|
|
assert_equal ["red", "yellow", "blue"], ExecJS.eval("'red yellow blue'.split(' ')")
|
|
end
|
|
|
|
def test_runtime_available
|
|
runtime = ExecJS::ExternalRuntime.new(:command => "nonexistent")
|
|
assert !runtime.available?
|
|
|
|
runtime = ExecJS::ExternalRuntime.new(:command => "ruby")
|
|
assert runtime.available?
|
|
end
|
|
end
|