Skip to content

Commit 03b5721

Browse files
committed
change a test assuming Hash keeps it's order (was failing on 1.8.7)
1 parent 663c7e7 commit 03b5721

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

test/unit/closure_compiler_test.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ def test_jar_and_java_specifiation
4747
end
4848

4949
def test_exceptions
50-
assert_raises(Closure::Error) do
50+
assert_raise(Closure::Error) do
5151
Compiler.new.compile('1++')
5252
end
53-
assert_raises(Closure::Error) do
53+
assert_raise(Closure::Error) do
5454
Compiler.new.compile('obj = [1 2, 3]')
5555
end
5656
end
@@ -65,7 +65,12 @@ def test_permissions
6565
end
6666

6767
def test_serialize_options
68-
assert_equal ["--externs", "library1.js", "--compilation_level", "ADVANCED_OPTIMIZATIONS"], Closure::Compiler.new.send(:serialize_options, 'externs' => 'library1.js', "compilation_level" => "ADVANCED_OPTIMIZATIONS")
68+
options = { 'externs' => 'library1.js', "compilation_level" => "ADVANCED_OPTIMIZATIONS" }
69+
# ["--externs", "library1.js", "--compilation_level", "ADVANCED_OPTIMIZATIONS"]
70+
# although Hash in 1.8 might change the order to :
71+
# ["--compilation_level", "ADVANCED_OPTIMIZATIONS", "--externs", "library1.js"]
72+
expected_options = options.to_a.map { |arr| [ "--#{arr[0]}", arr[1] ] }.flatten
73+
assert_equal expected_options, Closure::Compiler.new.send(:serialize_options, options)
6974
end
7075

7176
def test_serialize_options_for_arrays

0 commit comments

Comments
 (0)