ruby-changes:51964
From: eregon <ko1@a...>
Date: Sat, 4 Aug 2018 01:19:20 +0900 (JST)
Subject: [ruby-changes:51964] eregon:r64179 (trunk): Update to ruby/mspec@072849e
eregon 2018-08-04 01:19:10 +0900 (Sat, 04 Aug 2018) New Revision: 64179 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64179 Log: Update to ruby/mspec@072849e Removed files: trunk/spec/mspec/.gitignore Modified files: trunk/spec/mspec/Rakefile trunk/spec/mspec/lib/mspec/runner/filters/regexp.rb trunk/spec/mspec/spec/runner/filters/regexp_spec.rb trunk/spec/mspec/tool/pull-latest-mspec-spec Index: spec/mspec/.gitignore =================================================================== --- spec/mspec/.gitignore (revision 64178) +++ spec/mspec/.gitignore (nonexistent) @@ -1,26 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/spec/mspec/.gitignore#L0 -pkg -*.rbc -*.iml -*.iws -*.ipr -*.sw? - -.rbx - -# ctags dir -/tags - -*.gem -.bundle -.config -.yardoc -InstalledFiles -_yardoc -coverage -doc/ -lib/bundler/man -rdoc -spec/reports -test/tmp -test/version_tmp -tmp Property changes on: spec/mspec/.gitignore ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -LF \ No newline at end of property Index: spec/mspec/Rakefile =================================================================== --- spec/mspec/Rakefile (revision 64178) +++ spec/mspec/Rakefile (revision 64179) @@ -1,4 +1,3 @@ https://github.com/ruby/ruby/blob/trunk/spec/mspec/Rakefile#L1 -require 'bundler/gem_tasks' require 'bundler/setup' require 'rspec/core/rake_task' Index: spec/mspec/lib/mspec/runner/filters/regexp.rb =================================================================== --- spec/mspec/lib/mspec/runner/filters/regexp.rb (revision 64178) +++ spec/mspec/lib/mspec/runner/filters/regexp.rb (revision 64179) @@ -1,7 +1,23 @@ https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/runner/filters/regexp.rb#L1 -require 'mspec/runner/filters/match' +class RegexpFilter + def initialize(what, *regexps) + @what = what + @regexps = to_regexp(*regexps) + end + + def ===(string) + @regexps.any? { |regexp| regexp === string } + end + + def register + MSpec.register @what, self + end + + def unregister + MSpec.unregister @what, self + end -class RegexpFilter < MatchFilter - def to_regexp(*strings) - strings.map { |str| Regexp.new str } + def to_regexp(*regexps) + regexps.map { |str| Regexp.new str } end + private :to_regexp end Index: spec/mspec/spec/runner/filters/regexp_spec.rb =================================================================== --- spec/mspec/spec/runner/filters/regexp_spec.rb (revision 64178) +++ spec/mspec/spec/runner/filters/regexp_spec.rb (revision 64179) @@ -2,12 +2,30 @@ require File.dirname(__FILE__) + '/../.. https://github.com/ruby/ruby/blob/trunk/spec/mspec/spec/runner/filters/regexp_spec.rb#L2 require 'mspec/runner/mspec' require 'mspec/runner/filters/regexp' +describe MatchFilter, "#===" do + before :each do + @filter = RegexpFilter.new nil, 'a(b|c)', 'b[^ab]', 'cc?' + end + + it "returns true if the argument matches any of the #initialize strings" do + @filter.===('ab').should == true + @filter.===('bc suffix').should == true + @filter.===('prefix cc').should == true + end + + it "returns false if the argument matches none of the #initialize strings" do + @filter.===('aa').should == false + @filter.===('ba').should == false + @filter.===('prefix d suffix').should == false + end +end + describe RegexpFilter, "#to_regexp" do before :each do @filter = RegexpFilter.new nil end it "converts its arguments to Regexp instances" do - @filter.to_regexp('a(b|c)', 'b[^ab]', 'cc?').should == [/a(b|c)/, /b[^ab]/, /cc?/] + @filter.send(:to_regexp, 'a(b|c)', 'b[^ab]', 'cc?').should == [/a(b|c)/, /b[^ab]/, /cc?/] end end Index: spec/mspec/tool/pull-latest-mspec-spec =================================================================== --- spec/mspec/tool/pull-latest-mspec-spec (revision 64178) +++ spec/mspec/tool/pull-latest-mspec-spec (revision 64179) @@ -7,6 +7,7 @@ rm -rf spec/mspec https://github.com/ruby/ruby/blob/trunk/spec/mspec/tool/pull-latest-mspec-spec#L7 git clone --depth 1 https://github.com/ruby/mspec.git spec/mspec commit=$(git -C spec/mspec log -n 1 --format='%h') rm -rf spec/mspec/.git +rm -f spec/mspec/.travis.yml git add spec/mspec git commit -m "Update to ruby/mspec@${commit}" -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/