1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Add tests for assert_pattern_list

This commit is contained in:
Nobuyoshi Nakada 2022-08-18 23:33:23 +09:00
parent c53667691a
commit 7c1ed47097
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

View file

@ -26,4 +26,20 @@ class TestAssertion < Test::Unit::TestCase
return_in_assert_raise
end
end
def test_assert_pattern_list
assert_pattern_list([/foo?/], "foo")
assert_not_pattern_list([/foo?/], "afoo")
assert_not_pattern_list([/foo?/], "foo?")
assert_pattern_list([:*, /foo?/, :*], "foo")
assert_pattern_list([:*, /foo?/], "afoo")
assert_not_pattern_list([:*, /foo?/], "afoo?")
assert_pattern_list([/foo?/, :*], "foo?")
end
def assert_not_pattern_list(pattern_list, actual, message=nil)
assert_raise(Test::Unit::AssertionFailedError) do
assert_pattern_list(pattern_list, actual, message)
end
end
end