ruby-changes:44953
From: nobu <ko1@a...>
Date: Thu, 8 Dec 2016 17:25:26 +0900 (JST)
Subject: [ruby-changes:44953] nobu:r57026 (trunk): test/unit.rb: fix -n option
nobu 2016-12-08 17:25:21 +0900 (Thu, 08 Dec 2016) New Revision: 57026 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57026 Log: test/unit.rb: fix -n option * test/lib/test/unit.rb (non_options): turn name patterns into Regexps. Modified files: trunk/test/lib/test/unit.rb Index: test/lib/test/unit.rb =================================================================== --- test/lib/test/unit.rb (revision 57025) +++ test/lib/test/unit.rb (revision 57026) @@ -106,10 +106,10 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit.rb#L106 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"}) + filter = Regexp.union(*positive.map! {|s| Regexp.new(s[pos_pat, 1] || "\\A#{Regexp.quote(s)}\\z")}) end unless negative.empty? - negative = Regexp.union(*negative.map! {|s| s[neg_pat, 1]}) + negative = Regexp.union(*negative.map! {|s| Regexp.new(s[neg_pat, 1])}) filter = /\A(?=.*#{filter})(?!.*#{negative})/ end if Regexp === filter -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/