Add test for Test::Unit::CoreAssertions#assert_raise_with_message

This commit is contained in:
Nobuyoshi Nakada 2025-01-24 15:53:08 +09:00
parent 87426f57c9
commit ae94fca788
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465
Notes: git 2025-01-24 07:59:41 +00:00

View File

@ -27,6 +27,26 @@ class TestAssertion < Test::Unit::TestCase
end
end
def test_assert_raise_with_message
my_error = Class.new(StandardError)
assert_raise_with_message(my_error, "with message") do
raise my_error, "with message"
end
assert_raise(Test::Unit::AssertionFailedError) do
assert_raise_with_message(RuntimeError, "with message") do
raise my_error, "with message"
end
end
assert_raise(Test::Unit::AssertionFailedError) do
assert_raise_with_message(my_error, "without message") do
raise my_error, "with message"
end
end
end
def test_assert_pattern_list
assert_pattern_list([/foo?/], "foo")
assert_not_pattern_list([/foo?/], "afoo")