summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-11-09 15:16:23 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-11-09 15:20:44 +0900
commit3ff0a0b40c2e1fbdad2286f1dafe837f822d0e0d (patch)
tree790b7fed0d682cca920aa69dbce08de1bf602bee /tool
parent6cf7c0a48fb07a765d447404aba33636d9d87c89 (diff)
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.
Diffstat (limited to 'tool')
-rw-r--r--tool/lib/test/unit.rb15
1 files changed, 6 insertions, 9 deletions
diff --git a/tool/lib/test/unit.rb b/tool/lib/test/unit.rb
index 0482c8073f..80851eed16 100644
--- a/tool/lib/test/unit.rb
+++ b/tool/lib/test/unit.rb
@@ -240,6 +240,9 @@ module Test
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
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)