ruby-changes:72960
From: Nobuyoshi <ko1@a...>
Date: Thu, 18 Aug 2022 23:42:04 +0900 (JST)
Subject: [ruby-changes:72960] 7c1ed47097 (master): Add tests for assert_pattern_list
https://git.ruby-lang.org/ruby.git/commit/?id=7c1ed47097 From 7c1ed470976f3488dd655e092ec1015d6b2f8310 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Thu, 18 Aug 2022 23:33:23 +0900 Subject: 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 https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_assertion.rb#L26 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 -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/