Skip to content

Commit e3df994

Browse files
committed
Fix assertions in location_test.rb
* assert_raise's 2nd argument is the failure message, shown when the expected exception is not raised. It's not the expected message. See test-unit/test-unit#347
1 parent 609c80c commit e3df994

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

test/prism/ruby/location_test.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,22 @@ def test_join
1313
assert_equal 0, joined.start_offset
1414
assert_equal 10, joined.length
1515

16-
assert_raise(RuntimeError, "Incompatible locations") do
16+
e = assert_raise(RuntimeError) do
1717
argument.location.join(receiver.location)
1818
end
19+
assert_equal "Incompatible locations", e.message
1920

2021
other_argument = Prism.parse_statement("1234 + 567").arguments.arguments.first
2122

22-
assert_raise(RuntimeError, "Incompatible sources") do
23+
e = assert_raise(RuntimeError) do
2324
other_argument.location.join(receiver.location)
2425
end
26+
assert_equal "Incompatible sources", e.message
2527

26-
assert_raise(RuntimeError, "Incompatible sources") do
28+
e = assert_raise(RuntimeError) do
2729
receiver.location.join(other_argument.location)
2830
end
31+
assert_equal "Incompatible sources", e.message
2932
end
3033

3134
def test_character_offsets

0 commit comments

Comments
 (0)