diff options
| author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-18 04:57:25 +0000 |
|---|---|---|
| committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-18 04:57:25 +0000 |
| commit | ffcad81c191fdebce7fbafc56907464537273c75 (patch) | |
| tree | 618a69c191dcbcc5d412c17579f55300044470c6 /test | |
| parent | b118f5d82f9d23f388ff951dd0574bb18d7cf18a (diff) | |
merge revision(s) 54086,54211,54233: [Backport #12199]
* test/lib/test/unit.rb (Options#non_options): make regexp name
options prefixed with "!" negative filters.
* common.mk (TEST_EXCLUDES): use negative filter to exclude memory
leak tests. -x option excludes test files, not test methods.
* common.mk (TEST_EXCLUDES, EXCLUDE_TESTFRAMEWORK): use full spell
long option.
* cygwin/GNUmakefile.in (MSYS2_ARG_CONV_EXCL): suppress path name
conversions by msys2. [ruby-dev:49525] [Bug #12199]
* cygwin/GNUmakefile.in (MSYS2_ARG_CONV_EXCL_PARAM):
* add missing parentheses and remove double quotes.
* rename to get rid of recursive references.
* as --excludes-dir option is for a path name, its argument
should be converted.
[ruby-dev:49526] [Bug #12199]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@54627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
| -rw-r--r-- | test/lib/test/unit.rb | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/test/lib/test/unit.rb b/test/lib/test/unit.rb index f9c106f9ed..c92a5ec01d 100644 --- a/test/lib/test/unit.rb +++ b/test/lib/test/unit.rb @@ -87,7 +87,7 @@ module Test end opts.on '-n', '--name PATTERN', "Filter test method names on pattern: /REGEXP/ or STRING" do |a| - options[:filter] = a + (options[:filter] ||= []) << a end opts.on '--test-order=random|alpha|sorted', [:random, :alpha, :sorted] do |a| @@ -96,6 +96,30 @@ module Test end def non_options(files, options) + filter = options[:filter] + if filter + pos_pat = /\A\/(.*)\/\z/ + neg_pat = /\A!\/(.*)\/\z/ + negative, positive = filter.partition {|s| neg_pat =~ s} + if positive.empty? + filter = nil + elsif negative.empty? and positive.size == 1 and pos_pat !~ positive[0] + filter = positive[0] + else + filter = Regexp.union(*positive.map! {|s| s[pos_pat, 1] || "\\A#{Regexp.quote(s)}\\z"}) + end + unless negative.empty? + negative = Regexp.union(*negative.map! {|s| s[neg_pat, 1]}) + filter = /\A(?!.*#{negative})#{filter}/ + end + if Regexp === filter + # bypass conversion in minitest + def filter.=~(other) # :nodoc: + super unless Regexp === other + end + end + options[:filter] = filter + end true end end @@ -589,9 +613,7 @@ module Test @verbose = !options[:parallel] @output = Output.new(self) end - if /\A\/(.*)\/\z/ =~ (filter = options[:filter]) - filter = Regexp.new($1) - end + filter = options[:filter] type = "#{type}_methods" total = if filter suites.inject(0) {|n, suite| n + suite.send(type).grep(filter).size} |
