Permalink
Browse files

change a test assuming Hash keeps it's order (was failing on 1.8.7)

  • Loading branch information...
1 parent 663c7e7 commit 03b572136a92378217232a4b30cc43aaa6318818 @kares kares committed Jul 29, 2011
Showing with 8 additions and 3 deletions.
  1. +8 −3 test/unit/closure_compiler_test.rb
View
11 test/unit/closure_compiler_test.rb
@@ -47,10 +47,10 @@ def test_jar_and_java_specifiation
end
def test_exceptions
- assert_raises(Closure::Error) do
+ assert_raise(Closure::Error) do
Compiler.new.compile('1++')
end
- assert_raises(Closure::Error) do
+ assert_raise(Closure::Error) do
Compiler.new.compile('obj = [1 2, 3]')
end
end
@@ -65,7 +65,12 @@ def test_permissions
end
def test_serialize_options
- assert_equal ["--externs", "library1.js", "--compilation_level", "ADVANCED_OPTIMIZATIONS"], Closure::Compiler.new.send(:serialize_options, 'externs' => 'library1.js', "compilation_level" => "ADVANCED_OPTIMIZATIONS")
+ options = { 'externs' => 'library1.js', "compilation_level" => "ADVANCED_OPTIMIZATIONS" }
+ # ["--externs", "library1.js", "--compilation_level", "ADVANCED_OPTIMIZATIONS"]
+ # although Hash in 1.8 might change the order to :
+ # ["--compilation_level", "ADVANCED_OPTIMIZATIONS", "--externs", "library1.js"]
+ expected_options = options.to_a.map { |arr| [ "--#{arr[0]}", arr[1] ] }.flatten
+ assert_equal expected_options, Closure::Compiler.new.send(:serialize_options, options)
end
def test_serialize_options_for_arrays

0 comments on commit 03b5721

Please sign in to comment.