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
34 lines
811 B
Ruby
34 lines
811 B
Ruby
# Author:: Nathaniel Talbott.
|
|
# Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
|
|
# License:: Ruby license.
|
|
|
|
require 'test/unit/collector'
|
|
|
|
module Test
|
|
module Unit
|
|
module Collector
|
|
class ObjectSpace
|
|
include Collector
|
|
|
|
NAME = 'collected from the ObjectSpace'
|
|
|
|
def initialize(source=::ObjectSpace)
|
|
super()
|
|
@source = source
|
|
end
|
|
|
|
def collect(name=NAME)
|
|
suite = TestSuite.new(name)
|
|
sub_suites = []
|
|
@source.each_object(Class) do |klass|
|
|
if(Test::Unit::TestCase > klass)
|
|
add_suite(sub_suites, klass.suite)
|
|
end
|
|
end
|
|
sort(sub_suites).each{|s| suite << s}
|
|
suite
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|