blob: b7f3dd9930a8633730eb98626adecb1874a46d16 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
require 'abstract_unit'
require 'active_support/core_ext/class'
class A
end
module X
class B
end
end
module Y
module Z
class C
end
end
end
class ClassTest < Test::Unit::TestCase
def test_retrieving_subclasses
@parent = eval("class D; end; D")
@sub = eval("class E < D; end; E")
@subofsub = eval("class F < E; end; F")
assert_equal 2, @parent.subclasses.size
assert_equal [@subofsub.to_s], @sub.subclasses
assert_equal [], @subofsub.subclasses
assert_equal [@sub.to_s, @subofsub.to_s].sort, @parent.subclasses.sort
end
end
|