diff options
| author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-30 14:13:23 +0000 |
|---|---|---|
| committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-30 14:13:23 +0000 |
| commit | da33d0fee6a5cff53e8aac887bba1bebba2dd50b (patch) | |
| tree | 645dc6be51ba3aa9f7d4cf0941c1d92f7ee7cfb2 /lib/test/unit/collector/objectspace.rb | |
| parent | a19e3c36c7a923a931e9b96585f078bc370bf54a (diff) | |
| download | ruby-da33d0fee6a5cff53e8aac887bba1bebba2dd50b.tar.gz ruby-da33d0fee6a5cff53e8aac887bba1bebba2dd50b.tar.xz ruby-da33d0fee6a5cff53e8aac887bba1bebba2dd50b.zip | |
Reverts the changes of lib/test/unit.rb in r19502 and r19501.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/test/unit/collector/objectspace.rb')
| -rw-r--r-- | lib/test/unit/collector/objectspace.rb | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/test/unit/collector/objectspace.rb b/lib/test/unit/collector/objectspace.rb new file mode 100644 index 000000000..4a768c721 --- /dev/null +++ b/lib/test/unit/collector/objectspace.rb @@ -0,0 +1,40 @@ +# 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 Test::Unit::Collector + + NAME = 'collected from the subclasses of TestCase' + + def initialize(source=nil) + super() + @source = source + end + + def collect(name=NAME) + suite = TestSuite.new(name) + sub_suites = [] + if @source + @source.each_object(Class) do |klass| + if(Test::Unit::TestCase > klass) + add_suite(sub_suites, klass.suite) + end + end + else + TestCase::DECENDANT_CLASSES.each do |klass| + add_suite(sub_suites, klass.suite) + end + end + sort(sub_suites).each{|s| suite << s} + suite + end + end + end + end +end |
