1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Remove method filter hack for minitest

This commit is contained in:
Nobuyoshi Nakada 2021-09-11 16:43:02 +09:00
parent 0fbde94b27
commit 46bde60df3
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

View file

@ -172,13 +172,6 @@ module Test
negative = Regexp.union(*negative.map! {|s| Regexp.new(s[neg_pat, 1])}) negative = Regexp.union(*negative.map! {|s| Regexp.new(s[neg_pat, 1])})
filter = /\A(?=.*#{filter})(?!.*#{negative})/ filter = /\A(?=.*#{filter})(?!.*#{negative})/
end end
if Regexp === filter
filter = filter.dup
# bypass conversion in minitest
def filter.=~(other) # :nodoc:
super unless Regexp === other
end
end
options[:filter] = filter options[:filter] = filter
end end
true true
@ -1371,22 +1364,21 @@ module Test
header = "#{type}_suite_header" header = "#{type}_suite_header"
puts send(header, suite) if respond_to? header puts send(header, suite) if respond_to? header
filter = options[:filter] || '/./' filter = options[:filter]
filter = Regexp.new $1 if filter =~ /\/(.*)\//
all_test_methods = suite.send "#{type}_methods" all_test_methods = suite.send "#{type}_methods"
filtered_test_methods = all_test_methods.find_all { |m|
filter === m || filter === "#{suite}##{m}"
}
leakchecker = LeakChecker.new leakchecker = LeakChecker.new
if ENV["LEAK_CHECKER_TRACE_OBJECT_ALLOCATION"] if ENV["LEAK_CHECKER_TRACE_OBJECT_ALLOCATION"]
require "objspace" require "objspace"
trace = true trace = true
end end
assertions = filtered_test_methods.map { |method| assertions = all_test_methods.filter_map { |method|
if filter
next unless filter === method || filter === "#{suite}##{method}"
end
inst = suite.new method inst = suite.new method
inst._assertions = 0 inst._assertions = 0