[前][次][番号順一覧][スレッド一覧]

ruby-changes:69657

From: Nobuyoshi <ko1@a...>
Date: Tue, 9 Nov 2021 15:24:35 +0900 (JST)
Subject: [ruby-changes:69657] 3ff0a0b40c (master): Filter method names only if filtering method name only

https://git.ruby-lang.org/ruby.git/commit/?id=3ff0a0b40c

From 3ff0a0b40c2e1fbdad2286f1dafe837f822d0e0d Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Tue, 9 Nov 2021 15:16:23 +0900
Subject: Filter method names only if filtering method name only

If sole `filter` option doesn't seem including test case name,
match with method name only.
And if the filter is a Regexp or String, it never matches method
name symbols.
---
 tool/lib/test/unit.rb | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/tool/lib/test/unit.rb b/tool/lib/test/unit.rb
index 0482c8073fb..80851eed16d 100644
--- a/tool/lib/test/unit.rb
+++ b/tool/lib/test/unit.rb
@@ -240,6 +240,9 @@ module Test https://github.com/ruby/ruby/blob/trunk/tool/lib/test/unit.rb#L240
             filter = nil
           elsif negative.empty? and positive.size == 1 and pos_pat !~ positive[0]
             filter = positive[0]
+            unless /\A[A-Z]\w*(?:::[A-Z]\w*)*#/ =~ filter
+              filter = /##{Regexp.quote(filter)}\z/
+            end
           else
             filter = Regexp.union(*positive.map! {|s| Regexp.new(s[pos_pat, 1] || "\\A#{Regexp.quote(s)}\\z")})
           end
@@ -1497,15 +1500,9 @@ module Test https://github.com/ruby/ruby/blob/trunk/tool/lib/test/unit.rb#L1500
 
         all_test_methods = suite.send "#{type}_methods"
         if filter
-          if Regexp === filter
-            all_test_methods.select! {|method|
-              filter === "#{suite}##{method}"
-            }
-          else
-            all_test_methods.select! {|method|
-              filter === method || filter === "#{suite}##{method}"
-            }
-          end
+          all_test_methods.select! {|method|
+            filter === "#{suite}##{method}"
+          }
         end
         all_test_methods = @order.sort_by_name(all_test_methods)
 
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]