From 7c1ed470976f3488dd655e092ec1015d6b2f8310 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Thu, 18 Aug 2022 23:33:23 +0900 Subject: [PATCH] Add tests for assert_pattern_list --- tool/test/testunit/test_assertion.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tool/test/testunit/test_assertion.rb b/tool/test/testunit/test_assertion.rb index 8c83b447a7..d12a794a23 100644 --- a/tool/test/testunit/test_assertion.rb +++ b/tool/test/testunit/test_assertion.rb @@ -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