Skip to content

Commit

Permalink
drying up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Jun 10, 2008
1 parent 94c0788 commit 9a1447e
Show file tree
Hide file tree
Showing 17 changed files with 6 additions and 64 deletions.
10 changes: 0 additions & 10 deletions test.js

This file was deleted.

4 changes: 4 additions & 0 deletions test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ def debug(string)
end

undef :default_test

def setup
@runtime = Johnson::Runtime.new
end

def assert_js(expression, options={})
runtime = options[:runtime] || @runtime
Expand Down
2 changes: 1 addition & 1 deletion test/johnson/browser_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module Johnson
class BrowserTest < Johnson::TestCase
def setup
@runtime = Johnson::Runtime.new
super
@runtime.evaluate('Johnson.require("johnson/browser");')
end

Expand Down
4 changes: 0 additions & 4 deletions test/johnson/conversions/array_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
module Johnson
module Conversions
class ArrayTest < Johnson::TestCase
def setup
@runtime = Johnson::Runtime.new
end

def test_array_index_get
@runtime[:list] = [1, 2, 3, 4]
assert_equal(1, @runtime.evaluate("list[0]"))
Expand Down
4 changes: 0 additions & 4 deletions test/johnson/conversions/boolean_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
module Johnson
module Conversions
class BooleanTest < Johnson::TestCase
def setup
@runtime = Johnson::Runtime.new
end

def test_truthiness
@runtime[:v] = true
assert_same(true, @runtime.evaluate("v === true"))
Expand Down
4 changes: 0 additions & 4 deletions test/johnson/conversions/callable_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
module Johnson
module Conversions
class CallableTest < Johnson::TestCase
def setup
@runtime = Johnson::Runtime.new
end

def test_proc_works_in_jsland
@runtime[:squared] = Proc.new { |x| x * x }
assert_js_equal(4, "squared(2)")
Expand Down
4 changes: 0 additions & 4 deletions test/johnson/conversions/file_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
module Johnson
module Conversions
class FileTest < Johnson::TestCase
def setup
@runtime = Johnson::Runtime.new
end

def test_read_file
File.open(__FILE__, 'rb') { |f|
@runtime[:foo] = f
Expand Down
4 changes: 0 additions & 4 deletions test/johnson/conversions/nil_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
module Johnson
module Conversions
class NilTest < Johnson::TestCase
def setup
@runtime = Johnson::Runtime.new
end

def test_ruby_nil_is_js_null
@runtime[:v] = nil
assert_equal(true, @runtime.evaluate("v == null"))
Expand Down
4 changes: 0 additions & 4 deletions test/johnson/conversions/number_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
module Johnson
module Conversions
class NumberTest < Johnson::TestCase
def setup
@runtime = Johnson::Runtime.new
end

def test_ruby_fixnum_in_js
@runtime[:v] = 42

Expand Down
4 changes: 0 additions & 4 deletions test/johnson/conversions/regexp_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
module Johnson
module Conversions
class RegexpTest < Johnson::TestCase
def setup
@runtime = Johnson::Runtime.new
end

def test_regex_converts
@runtime[:x] = /aaron/
@runtime[:y] = /john/i
Expand Down
4 changes: 0 additions & 4 deletions test/johnson/conversions/string_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
module Johnson
module Conversions
class StringTest < Johnson::TestCase
def setup
@runtime = Johnson::Runtime.new
end

def test_ruby_string_in_js
@runtime[:v] = "foo"
assert_js("'foo' == v")
Expand Down
4 changes: 0 additions & 4 deletions test/johnson/conversions/struct_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
module Johnson
module Conversions
class StructTest < Johnson::TestCase
def setup
@runtime = Johnson::Runtime.new
end

def test_use_struct
f = Struct.new(:phil_collins).new
f.phil_collins = 'awesome'
Expand Down
4 changes: 0 additions & 4 deletions test/johnson/conversions/symbol_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
module Johnson
module Conversions
class SymbolTest < Johnson::TestCase
def setup
@runtime = Johnson::Runtime.new
end

def test_symbols_are_interned
@runtime[:v] = :symbol
@runtime[:x] = :symbol
Expand Down
4 changes: 0 additions & 4 deletions test/johnson/conversions/thread_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
module Johnson
module Conversions
class ThreadTest < Johnson::TestCase
def setup
@runtime = Johnson::Runtime.new
end

def test_manipulate_thread
thread = Thread.new { }
@runtime['thread'] = thread
Expand Down
2 changes: 1 addition & 1 deletion test/johnson/extensions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Johnson
module Extensions
class DefinePropertyTest < Johnson::TestCase
def setup
@runtime = Johnson::Runtime.new
super
@runtime.evaluate("x = {}")
end

Expand Down
4 changes: 0 additions & 4 deletions test/johnson/prelude_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

module Johnson
class PreludeTest < Johnson::TestCase
def setup
@runtime = Johnson::Runtime.new
end

def test_symbols_are_interned
assert(@runtime.evaluate("Johnson.symbolize('foo') === Johnson.symbolize('foo')"))
end
Expand Down
4 changes: 0 additions & 4 deletions test/johnson/runtime_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

module Johnson
class RuntimeTest < Johnson::TestCase
def setup
@runtime = Johnson::Runtime.new
end

def test_default_delegate_is_spidermonkey
assert_equal(Johnson::SpiderMonkey::Runtime, @runtime.delegate.class)
end
Expand Down

0 comments on commit 9a1447e

Please sign in to comment.