mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
09d2946061
* lib/test/unit/ui/testrunnermediator.rb: moved the run flag to a more central location. * lib/test/unit.rb: ditto. * lib/test/unit.rb: extracted the running code in to AutoRunner. * lib/test/unit/autorunner.rb: added. * lib/test/unit/collector/objectspace.rb: extracted common test collection functionality in to a module. * lib/test/unit/collector.rb: ditto; added. * test/testunit/collector/test_objectspace.rb: ditto. * lib/test/unit/collector/dir.rb: added. Supports collecting tests out of a directory structure. * test/testunit/collector/test_dir.rb: added. * test/runner.rb: simplified to use the new capabilities. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
43 lines
873 B
Ruby
43 lines
873 B
Ruby
module Test
|
|
module Unit
|
|
module Collector
|
|
def initialize
|
|
@filters = []
|
|
end
|
|
|
|
def filter=(filters)
|
|
@filters = case(filters)
|
|
when Proc
|
|
[filters]
|
|
when Array
|
|
filters
|
|
end
|
|
end
|
|
|
|
def add_suite(destination, suite)
|
|
to_delete = suite.tests.find_all{|t| !include?(t)}
|
|
to_delete.each{|t| suite.delete(t)}
|
|
destination << suite unless(suite.size == 0)
|
|
end
|
|
|
|
def include?(test)
|
|
return true if(@filters.empty?)
|
|
@filters.each do |filter|
|
|
result = filter[test]
|
|
if(result.nil?)
|
|
next
|
|
elsif(!result)
|
|
return false
|
|
else
|
|
return true
|
|
end
|
|
end
|
|
true
|
|
end
|
|
|
|
def sort(suites)
|
|
suites.sort_by{|s| s.name}
|
|
end
|
|
end
|
|
end
|
|
end
|