Hi,

Now test/runner.rb has the feature to perform only the specified
tests by commandline switch -p (--pattern).

I propose the reverse switch -x (--exclude).

When there are some unit tests which block execution of the whole
test, we can temporarily avoid the tests by using this switch.

this is the patch:

Index: lib/test/unit/autorunner.rb =================================================================== RCS file: /home/cvs/ruby/lib/test/unit/autorunner.rb,v retrieving revision 1.8 diff -u -2 -p -r1.8 autorunner.rb --- lib/test/unit/autorunner.rb 24 Dec 2003 05:08:03 -0000 1.8 +++ lib/test/unit/autorunner.rb 30 Aug 2004 02:00:22 -0000 @@ -57,4 +57,5 @@ module Test c.filter = r.filters c.pattern = r.pattern if(r.pattern) + c.exclude = r.exclude if(r.exclude) c.collect(*(r.to_run.empty? ? ['.'] : r.to_run)) end, @@ -62,5 +63,5 @@ module Test attr_reader :suite - attr_accessor :output_level, :filters, :to_run, :pattern + attr_accessor :output_level, :filters, :to_run, :pattern, :exclude attr_writer :runner, :collector @@ -113,4 +114,9 @@ module Test @pattern = Regexp.new(e.sub(%r{\A/(.*)/\Z}m, '\\1')) end + + o.on('-x', '--exclude=PATTERN', String, + "Ignore files to collect against PATTERN.") do |e| + @exclude = Regexp.new(e.sub(%r{\A/(.*)/\Z}m, '\\1')) + end end Index: lib/test/unit/collector/dir.rb =================================================================== RCS file: /home/cvs/ruby/lib/test/unit/collector/dir.rb,v retrieving revision 1.5 diff -u -2 -p -r1.5 dir.rb --- lib/test/unit/collector/dir.rb 9 Jan 2004 04:26:05 -0000 1.5 +++ lib/test/unit/collector/dir.rb 30 Aug 2004 02:00:23 -0000 @@ -8,5 +8,5 @@ module Test include Collector - attr_writer :pattern + attr_writer :pattern, :exclude def initialize(dir=::Dir, file=::File, object_space=::ObjectSpace, req=nil) @@ -17,4 +17,5 @@ module Test @req = req @pattern = /\Atest_.*\.rb\Z/m + @exclude = nil end @@ -56,4 +57,5 @@ module Test else (next unless(@pattern =~ e)) if(@pattern) + (next if(@exclude =~ e)) if(@exclude) collect_file(e_name, sub_suites, already_gathered) end
Regards, -- U.Nakamura <usa / garbagecollect.jp>