mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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.
This commit is contained in:
parent
6cf7c0a48f
commit
3ff0a0b40c
1 changed files with 6 additions and 9 deletions
|
@ -240,6 +240,9 @@ module Test
|
||||||
filter = nil
|
filter = nil
|
||||||
elsif negative.empty? and positive.size == 1 and pos_pat !~ positive[0]
|
elsif negative.empty? and positive.size == 1 and pos_pat !~ positive[0]
|
||||||
filter = positive[0]
|
filter = positive[0]
|
||||||
|
unless /\A[A-Z]\w*(?:::[A-Z]\w*)*#/ =~ filter
|
||||||
|
filter = /##{Regexp.quote(filter)}\z/
|
||||||
|
end
|
||||||
else
|
else
|
||||||
filter = Regexp.union(*positive.map! {|s| Regexp.new(s[pos_pat, 1] || "\\A#{Regexp.quote(s)}\\z")})
|
filter = Regexp.union(*positive.map! {|s| Regexp.new(s[pos_pat, 1] || "\\A#{Regexp.quote(s)}\\z")})
|
||||||
end
|
end
|
||||||
|
@ -1497,15 +1500,9 @@ module Test
|
||||||
|
|
||||||
all_test_methods = suite.send "#{type}_methods"
|
all_test_methods = suite.send "#{type}_methods"
|
||||||
if filter
|
if filter
|
||||||
if Regexp === filter
|
all_test_methods.select! {|method|
|
||||||
all_test_methods.select! {|method|
|
filter === "#{suite}##{method}"
|
||||||
filter === "#{suite}##{method}"
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
all_test_methods.select! {|method|
|
|
||||||
filter === method || filter === "#{suite}##{method}"
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
all_test_methods = @order.sort_by_name(all_test_methods)
|
all_test_methods = @order.sort_by_name(all_test_methods)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue