ruby/lib/test/unit/collector/objectspace.rb
nobu 75c1cac7f3 * {ext,lib,test}/**/*.rb: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@27366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-16 21:51:01 +00:00

34 lines
787 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