mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
ccf99b9ce6
* eval.c (ev_const_defined): adopt to ev_const_get() using rb_const_defined_fallback(). * variable.c (rb_const_get_fallback): new function to implement constant search. * variable.c (rb_const_defined_fallback): new function to implement constant definition check. * variable.c (rb_const_get_0): adopt to new behavior. constants are looked up in the order of: current class, super classes (but Object), lexically external classes/modules, and Object. * variable.c (rb_const_defined_0): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
34 lines
823 B
Ruby
34 lines
823 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 Test::Unit::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
|