2003-09-18 22:48:46 -04:00
|
|
|
# Author:: Nathaniel Talbott.
|
|
|
|
# Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
|
|
|
|
# License:: Ruby license.
|
|
|
|
|
2003-10-08 09:21:28 -04:00
|
|
|
require 'test/unit/collector'
|
|
|
|
|
2003-09-18 22:48:46 -04:00
|
|
|
module Test
|
|
|
|
module Unit
|
|
|
|
module Collector
|
|
|
|
class ObjectSpace
|
2006-02-17 03:40:52 -05:00
|
|
|
include Test::Unit::Collector
|
2003-10-08 09:21:28 -04:00
|
|
|
|
2003-09-18 22:48:46 -04:00
|
|
|
NAME = 'collected from the ObjectSpace'
|
|
|
|
|
|
|
|
def initialize(source=::ObjectSpace)
|
2003-10-08 09:21:28 -04:00
|
|
|
super()
|
2003-09-18 22:48:46 -04:00
|
|
|
@source = source
|
|
|
|
end
|
|
|
|
|
|
|
|
def collect(name=NAME)
|
|
|
|
suite = TestSuite.new(name)
|
2003-10-03 18:35:19 -04:00
|
|
|
sub_suites = []
|
2003-09-18 22:48:46 -04:00
|
|
|
@source.each_object(Class) do |klass|
|
2003-10-03 18:35:19 -04:00
|
|
|
if(Test::Unit::TestCase > klass)
|
2003-10-08 09:21:28 -04:00
|
|
|
add_suite(sub_suites, klass.suite)
|
2003-10-03 18:35:19 -04:00
|
|
|
end
|
2003-09-18 22:48:46 -04:00
|
|
|
end
|
2003-10-08 09:21:28 -04:00
|
|
|
sort(sub_suites).each{|s| suite << s}
|
2003-09-18 22:48:46 -04:00
|
|
|
suite
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|