Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 42 lines (32 sloc) 1.077 kb
d50ae78 Skeletal delegating Johnson::Context.
jbarnette authored
1 require "rubygems"
2 require "test/unit"
3 require "mocha"
4
053d733 More deps improvements, skeletal extension bits, etc.
jbarnette authored
5 %w(../lib ../ext/spidermonkey).each do |path|
6 $LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), path)))
7 end
8
9 # If the test isn't running from Rake, make sure the extension's current.
10 Rake rescue Dir.chdir(File.dirname(__FILE__) + "/..") { %x(rake extensions) }
11
12 require "johnson"
85757c7 Conversions for nil, booleans, and strings.
jbarnette authored
13
14 module Johnson
15 class TestCase < Test::Unit::TestCase
16 def default_test; end
17
18 def assert_js(expression, options={})
19 context = options[:context] || @context
1d6a6e1 Support for marshaling numbers.
jbarnette authored
20 assert(context.evaluate(expression), "Expected JS expression [#{expression}] to be true.")
21 end
22
23 def assert_js_equal(expected, expression, options={})
24 context = options[:context] || @context
25 assert_equal(expected, context.evaluate(expression))
85757c7 Conversions for nil, booleans, and strings.
jbarnette authored
26 end
27 end
cb8d054 adding node tests
aaronp authored
28
29 class NodeTestCase < Test::Unit::TestCase
30 include Johnson::Nodes
31
32 undef :default_test
33 def setup
34 @parser = Johnson::Parser
35 end
36
37 def assert_sexp(expected, actual)
38 assert_equal(expected, actual.to_sexp)
39 end
40 end
85757c7 Conversions for nil, booleans, and strings.
jbarnette authored
41 end
Something went wrong with that request. Please try again.