1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/test/unit/testsuite.rb: changed #<< to return self, and added

#delete.

	* test/testunit/test_testsuite.rb: ditto. Also slightly refactored
	  #test_size.

	* lib/test/unit/collector/objectspace.rb: collector now preserves the
	  hierarchy of suites.

	* test/testunit/collector/test_objectspace.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ntalbott 2003-10-03 22:35:19 +00:00
parent df0e9dbe97
commit 51267d1177
5 changed files with 63 additions and 23 deletions

View file

@ -15,11 +15,16 @@ module Test
def collect(name=NAME)
suite = TestSuite.new(name)
tests = []
sub_suites = []
@source.each_object(Class) do |klass|
tests.concat(klass.suite.tests) if(Test::Unit::TestCase > klass)
if(Test::Unit::TestCase > klass)
sub_suite = klass.suite
to_delete = sub_suite.tests.find_all{|t| !include(t)}
to_delete.each{|t| sub_suite.delete(t)}
sub_suites << sub_suite unless(sub_suite.size == 0)
end
end
tests.sort_by{|t| t.name}.each{|test| suite << test if(include(test))}
sub_suites.sort_by{|s| s.name}.each{|s| suite << s}
suite
end

View file

@ -39,6 +39,11 @@ module Test
# Adds the test to the suite.
def <<(test)
@tests << test
self
end
def delete(test)
@tests.delete(test)
end
# Retuns the rolled up number of tests in this suite;