Skip to content

Commit 687213d

Browse files
committed
use a more idiomatic form of assert_raises
1 parent e0a6f43 commit 687213d

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

test/yarp/ruby_api_test.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,20 @@ def test_location_join
3939
assert_equal 0, joined.start_offset
4040
assert_equal 10, joined.length
4141

42-
e = assert_raises RuntimeError do
42+
assert_raises RuntimeError, "Incompatible locations" do
4343
arg.location.join(recv.location)
4444
end
45-
assert_equal "Incompatible locations", e.message
4645

4746
other_recv, other_args_node, _ = parse_expression("1234 + 567").child_nodes
4847
other_arg = other_args_node.arguments[0]
4948

50-
e = assert_raises RuntimeError do
49+
assert_raises RuntimeError, "Incompatible sources" do
5150
other_arg.location.join(recv.location)
5251
end
53-
assert_equal "Incompatible sources", e.message
5452

55-
e = assert_raises RuntimeError do
53+
assert_raises RuntimeError, "Incompatible sources" do
5654
recv.location.join(other_arg.location)
5755
end
58-
assert_equal "Incompatible sources", e.message
5956
end
6057

6158
private

0 commit comments

Comments
 (0)