ruby_ex 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data/ChangeLog +693 -0
  2. data/NEWS +74 -0
  3. data/SPEC.dyn.yml +6 -6
  4. data/SPEC.gemspec +14 -0
  5. data/SPEC.yml +4 -4
  6. data/lib/abstract.rb +2 -4
  7. data/lib/abstract_node.rb +1 -2
  8. data/lib/algorithms/simulated_annealing.rb +50 -29
  9. data/lib/attributed_class.rb +50 -21
  10. data/lib/auto_object.rb +102 -0
  11. data/lib/blank_slate.rb +102 -0
  12. data/lib/cache.rb +1 -2
  13. data/lib/choose.rb +165 -163
  14. data/lib/commands.rb +2 -3
  15. data/lib/commands/command.rb +47 -20
  16. data/lib/commands/datas.rb +1 -1
  17. data/lib/commands/datas/composite.rb +5 -1
  18. data/lib/commands/datas/data.rb +102 -5
  19. data/lib/commands/datas/factory.rb +13 -6
  20. data/lib/commands/datas/temp.rb +3 -5
  21. data/lib/commands/factory.rb +1 -1
  22. data/lib/commands/helpers.rb +1 -1
  23. data/lib/commands/pipe.rb +10 -1
  24. data/lib/commands/runners.rb +1 -1
  25. data/lib/commands/runners/exec.rb +1 -1
  26. data/lib/commands/runners/fork.rb +3 -16
  27. data/lib/commands/runners/mock.rb +67 -0
  28. data/lib/commands/runners/runner.rb +5 -3
  29. data/lib/commands/runners/system.rb +1 -1
  30. data/lib/commands/seq.rb +2 -1
  31. data/lib/config_file.rb +10 -2
  32. data/lib/const_regexp.rb +1 -2
  33. data/lib/{dlogger.rb → d_logger.rb} +1 -2
  34. data/lib/daemon.rb +1 -2
  35. data/lib/diff.rb +1 -2
  36. data/lib/drb/drb_observable.rb +1 -2
  37. data/lib/drb/drb_observable_pool.rb +2 -2
  38. data/lib/drb/drb_service.rb +1 -2
  39. data/lib/drb/drb_undumped_attributes.rb +1 -2
  40. data/lib/drb/drb_undumped_indexed_object.rb +1 -2
  41. data/lib/drb/insecure_protected_methods.rb +1 -2
  42. data/lib/drb_ex.rb +2 -2
  43. data/lib/file_type.rb +466 -0
  44. data/lib/generate_id.rb +12 -6
  45. data/lib/genpasswd.rb +22 -0
  46. data/lib/hash_eval.rb +83 -0
  47. data/lib/histogram.rb +1 -2
  48. data/lib/hookable.rb +3 -4
  49. data/lib/hooker.rb +1 -3
  50. data/lib/html_encode.rb +191 -0
  51. data/lib/indexed_node.rb +0 -1
  52. data/lib/io_marshal.rb +4 -2
  53. data/lib/ioo.rb +3 -2
  54. data/lib/kill_all.rb +46 -0
  55. data/lib/labeled_node.rb +0 -1
  56. data/lib/logger_observer.rb +8 -4
  57. data/lib/md5sum.rb +3 -3
  58. data/lib/meta_factory.rb +99 -0
  59. data/lib/method_call.rb +87 -0
  60. data/lib/mocks.rb +12 -0
  61. data/lib/mocks/assertions.rb +50 -0
  62. data/lib/mocks/method_logger.rb +40 -0
  63. data/lib/mocks/mock.rb +64 -0
  64. data/lib/mocks/object.rb +47 -0
  65. data/lib/mocks/observer.rb +38 -0
  66. data/lib/module/autoload_tree.rb +30 -29
  67. data/lib/module/hierarchy.rb +176 -171
  68. data/lib/module/instance_method_visibility.rb +39 -38
  69. data/lib/node.rb +0 -1
  70. data/lib/object_monitor.rb +1 -2
  71. data/lib/object_monitor_activity.rb +1 -2
  72. data/lib/observable.rb +1 -2
  73. data/lib/observable_pool.rb +1 -2
  74. data/lib/{orderedhash.rb → ordered_hash.rb} +41 -5
  75. data/lib/pp_hierarchy.rb +7 -2
  76. data/lib/r_path.rb +307 -0
  77. data/lib/random_generators.rb +7 -20
  78. data/lib/random_generators/random_generator.rb +2 -4
  79. data/lib/random_generators/ruby.rb +4 -2
  80. data/lib/regex_path.rb +124 -0
  81. data/lib/ruby_ex.rb +28 -98
  82. data/lib/safe_eval.rb +1 -2
  83. data/lib/sendmail.rb +14 -17
  84. data/lib/service_manager.rb +1 -2
  85. data/lib/shuffle.rb +6 -2
  86. data/lib/spring.rb +1 -2
  87. data/lib/spring_set.rb +1 -2
  88. data/lib/{symtbl.rb → sym_tbl.rb} +90 -5
  89. data/lib/sym_tbl_gsub.rb +227 -0
  90. data/lib/{synflow.rb → syn_flow.rb} +1 -2
  91. data/lib/text.rb +218 -0
  92. data/lib/timeout_ex.rb +1 -2
  93. data/lib/trace.rb +9 -8
  94. data/lib/uri/druby.rb +1 -2
  95. data/lib/uri/file.rb +1 -1
  96. data/lib/uri/ftp_ex.rb +1 -1
  97. data/lib/uri/http_ex.rb +1 -1
  98. data/lib/uri/mysql.rb +121 -0
  99. data/lib/uri/pgsql.rb +19 -38
  100. data/lib/uri/svn.rb +1 -2
  101. data/lib/uri_ex.rb +45 -3
  102. data/lib/verbose_object.rb +181 -38
  103. data/lib/yaml/chop_header.rb +19 -11
  104. data/lib/yaml/transform.rb +17 -11
  105. data/lib/yaml/yregexpath.rb +11 -5
  106. data/test/algorithms/simulated_annealing_test.rb +2 -2
  107. data/test/resources/foo.tar.gz +0 -0
  108. data/test/resources/tar.gz.log +49 -0
  109. data/test/sanity-suite.yml +5 -7
  110. data/test/sanity/multiple-requires.yml +17 -7
  111. data/test/sanity/single-requires.yml +38 -20
  112. data/test/stress-tests/threads_and_exceptions.yml +13 -0
  113. data/test/test-unit-setup.rb +3 -1
  114. data/test/unit-suite.yml +7 -8
  115. metadata +42 -31
  116. data/lib/algorithms.rb +0 -12
  117. data/lib/ask.rb +0 -100
  118. data/lib/checkout.rb +0 -12
  119. data/lib/dumpable_proc.rb +0 -57
  120. data/lib/filetype.rb +0 -229
  121. data/lib/thread_mutex.rb +0 -11
  122. data/lib/yaml/basenode_ext.rb +0 -63
@@ -0,0 +1,38 @@
1
+ # Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
2
+ # Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
3
+ # License:: Gnu General Public License.
4
+ # Revision:: $Id: observer.rb 339 2005-09-06 23:27:27Z ertai $
5
+
6
+ require 'mocks'
7
+
8
+ module Mocks
9
+
10
+ class Observer < Mock
11
+ concrete
12
+
13
+ def update ( *args, &block )
14
+ mock_add MethodCall.new(:update, *args, &block)
15
+ end
16
+
17
+ end # class Observer
18
+
19
+ test_section __FILE__ do
20
+
21
+ class TestObserver < ::Test::Unit::TestCase
22
+
23
+ def setup
24
+ @proc = proc { 43 }
25
+ @obj = Mocks::Observer.new
26
+ end
27
+
28
+ def test_simple
29
+ @obj.update(:foo, :bar, 42, &@proc)
30
+ @obj.update(:bar)
31
+ assert_equal([[:foo, :bar, 42], [:bar]], @obj.mock_args)
32
+ end
33
+
34
+ end # class TestObserver
35
+
36
+ end
37
+
38
+ end # module Mocks
@@ -1,15 +1,10 @@
1
- # Copyright: Copyright (c) 2004 Nicolas Despres. All rights reserved.
2
- # Author: Nicolas Despres <polrop@lrde.epita.fr>.
3
- # License: Gnu General Public License.
1
+ # Copyright:: Copyright (c) 2004 Nicolas Despres. All rights reserved.
2
+ # Author:: Nicolas Despres <polrop@lrde.epita.fr>.
3
+ # License:: Gnu General Public License.
4
+ # Revision:: $Id: autoload_tree.rb 339 2005-09-06 23:27:27Z ertai $
4
5
 
5
- # $LastChangedBy: ertai $
6
- # $Id: autoload_tree.rb 279 2005-06-05 17:46:53Z ertai $
7
6
 
8
-
9
- require 'ruby_ex'
10
-
11
-
12
- class Module
7
+ module AutoloadTree
13
8
 
14
9
  def autoload_tree(dir, recursive=true, &block)
15
10
  pdir = Pathname.new(dir)
@@ -33,33 +28,39 @@ class Module
33
28
  end
34
29
  end
35
30
 
36
- end # class Module
31
+ end # module AutoloadTree
32
+
33
+ class Module
37
34
 
35
+ include AutoloadTree
38
36
 
39
- test_section __FILE__ do
37
+ end # class Module
40
38
 
41
- class AutoloadTreeTest < Test::Unit::TestCase
39
+ module AutoloadTree
42
40
 
43
- REPO_DIR = __FILE__.to_path.dirname.parent.parent + 'test/resources/autoload_tree'
41
+ test_section __FILE__ do
44
42
 
45
- module AutoloadTree; end
43
+ class AutoloadTreeTest < Test::Unit::TestCase
46
44
 
47
- #
48
- # Test
49
- #
50
- def test_autoload_tree
51
- $: << REPO_DIR
52
- AutoloadTree.autoload_tree(REPO_DIR) { |p| p.to_s.sub!(/\.rb$/, '') }
53
- ["Foo", "B", "A"].each do |x|
54
- assert(AutoloadTree.constants.include?(x), "#{x} is missing")
55
- end
56
- assert_equal(["C"], AutoloadTree::Foo.constants)
57
- $:.delete(REPO_DIR)
58
- end
45
+ REPO_DIR = __FILE__.to_path.dirname.parent.parent + 'test/resources/autoload_tree'
59
46
 
60
- end # class AutoloadTreeTest
47
+ module AutoloadTree; end
61
48
 
49
+ #
50
+ # Test
51
+ #
52
+ def test_autoload_tree
53
+ $: << REPO_DIR
54
+ AutoloadTree.autoload_tree(REPO_DIR) { |p| p.to_s.sub!(/\.rb$/, '') }
55
+ ["Foo", "B", "A"].each do |x|
56
+ assert(AutoloadTree.constants.include?(x), "#{x} is missing")
57
+ end
58
+ assert_equal(["C"], AutoloadTree::Foo.constants)
59
+ $:.delete(REPO_DIR)
60
+ end
62
61
 
63
- end
62
+ end # class AutoloadTreeTest
64
63
 
64
+ end
65
65
 
66
+ end # module AutoloadTree
@@ -3,13 +3,12 @@
3
3
  # License: Gnu General Public License.
4
4
 
5
5
  # $LastChangedBy: polrop $
6
- # $Id: hierarchy.rb 279 2005-06-05 17:46:53Z ertai $
6
+ # $Id: hierarchy.rb 339 2005-09-06 23:27:27Z ertai $
7
7
 
8
- require 'ruby_ex'
9
8
 
10
9
  # Extend the Module class with method to manipulate inheritance relation
11
10
  # between constants of a module.
12
- class Module
11
+ module Hierarchy
13
12
 
14
13
  # Return the list of all sub classes of base_class (including itself).
15
14
  # If force_autoload is false, not yet loaded constants will be ignored.
@@ -37,7 +36,7 @@ class Module
37
36
  # See sub_classes for a description of the recursive argument.
38
37
  def remove_class(base_class, recursive=false)
39
38
  subs = sub_classes(base_class, true, recursive)
40
- re = Regexp.new("^#{name}::")
39
+ re = /^#{name}::/
41
40
  result = []
42
41
  subs.each do |sub|
43
42
  sub_name = sub.to_s.sub!(re, '')
@@ -118,9 +117,9 @@ class Module
118
117
  private
119
118
  def sub_classes_tree_rec(base_classes, csts)
120
119
  result = {}
121
- next_csts = []
120
+ next_csts = Set.new
122
121
  base_classes.each do |b|
123
- next_base_classes = []
122
+ next_base_classes = Set.new
124
123
  csts.each do |c|
125
124
  c.superclass == b ? next_base_classes << c : next_csts << c;
126
125
  end
@@ -136,199 +135,205 @@ class Module
136
135
  end
137
136
  end
138
137
 
138
+ end # module Hierarchy
139
+
140
+ class Module
141
+
142
+ include Hierarchy
143
+
139
144
  end # class Module
140
145
 
146
+ module Hierarchy
141
147
 
142
- test_section __FILE__ do
148
+ test_section __FILE__ do
143
149
 
144
- require 'diff'
150
+ require 'diff'
145
151
 
146
152
 
147
- class HierarchyTest < Test::Unit::TestCase
153
+ class HierarchyTest < Test::Unit::TestCase
148
154
 
149
- module M
155
+ module M
150
156
 
151
- class A; end
152
- class B < A; end
153
- class C; end
154
- FOO = 42
157
+ class A; end
158
+ class B < A; end
159
+ class C; end
160
+ FOO = 42
155
161
 
156
- end
162
+ end
157
163
 
158
- def test_sub_classes
159
- sub_classes = M.sub_classes(HierarchyTest::M::A)
160
- assert_equal(2, sub_classes.size)
161
- [HierarchyTest::M::B, HierarchyTest::M::A].each do |x|
162
- assert(sub_classes.include?(x))
163
- end
164
- assert_equal([HierarchyTest::M::C], M.sub_classes(M::C))
165
- end
164
+ def test_sub_classes
165
+ sub_classes = M.sub_classes(HierarchyTest::M::A)
166
+ assert_equal(2, sub_classes.size)
167
+ [HierarchyTest::M::B, HierarchyTest::M::A].each do |x|
168
+ assert(sub_classes.include?(x))
169
+ end
170
+ assert_equal([HierarchyTest::M::C], M.sub_classes(M::C))
171
+ end
166
172
 
167
- module Mautoload
173
+ module Mautoload
168
174
 
169
- class A; end
170
- class B < A; end
171
- autoload(:C, '/foo')
172
- FOO = 42
175
+ class A; end
176
+ class B < A; end
177
+ autoload(:C, '/foo')
178
+ FOO = 42
173
179
 
174
- end
180
+ end
175
181
 
176
- def test_sub_classes_force_autoload
177
- sub_classes = Mautoload.sub_classes(Mautoload::A)
178
- assert_equal(2, sub_classes.size)
179
- [Mautoload::B, Mautoload::A].each do |x|
180
- assert(sub_classes.include?(x))
181
- end
182
- assert_equal(4, Mautoload.constants.size)
183
- assert_not_nil(Mautoload.autoload?(:C))
184
- assert_raises(LoadError) { Mautoload.sub_classes(Mautoload::A, true) }
185
- assert_equal(3, Mautoload.constants.size)
186
- assert_nil(Mautoload.autoload?(:C))
187
- end
182
+ def test_sub_classes_force_autoload
183
+ sub_classes = Mautoload.sub_classes(Mautoload::A)
184
+ assert_equal(2, sub_classes.size)
185
+ [Mautoload::B, Mautoload::A].each do |x|
186
+ assert(sub_classes.include?(x))
187
+ end
188
+ assert_equal(4, Mautoload.constants.size)
189
+ assert_not_nil(Mautoload.autoload?(:C))
190
+ assert_raise(MissingSourceFile, LoadError) { Mautoload.sub_classes(Mautoload::A, true) }
191
+ assert_equal(3, Mautoload.constants.size)
192
+ assert_nil(Mautoload.autoload?(:C))
193
+ end
188
194
 
189
- module Mrec
190
- class A; end
191
- class B < A; end
192
- module M
193
- class C < A; end
194
- class D < B; end
195
- class E < D; end
196
- class Y; end
197
- end
198
- class Z; end
199
- FOO = 42
200
- end
195
+ module Mrec
196
+ class A; end
197
+ class B < A; end
198
+ module M
199
+ class C < A; end
200
+ class D < B; end
201
+ class E < D; end
202
+ class Y; end
203
+ end
204
+ class Z; end
205
+ FOO = 42
206
+ end
201
207
 
202
- def test_sub_classes_recursive
203
- sub_classes = Mrec.sub_classes(Mrec::A)
204
- assert_equal(2, sub_classes.size)
205
- [Mrec::B, Mrec::A].each do |x|
206
- assert(sub_classes.include?(x))
207
- end
208
- sub_classes = Mrec.sub_classes(Mrec::A, false, true)
209
- assert_equal(5, sub_classes.size)
210
- [Mrec::B, Mrec::A, Mrec::M::C, Mrec::M::D, Mrec::M::E].each do |x|
211
- assert(sub_classes.include?(x))
212
- end
213
- r = Mrec.remove_class(Mrec::A, true)
214
- assert_equal(5, r.size)
215
- ['B', 'A', 'M::E', 'M::C', 'M::D'].each do |x|
216
- assert(r.include?(x))
217
- end
218
- assert_equal(3, Mrec.constants.size)
219
- ['FOO', 'M', 'Z'].each { |x| assert(Mrec.constants.include?(x)) }
220
- assert_equal(1, Mrec::M.constants.size)
221
- ['Y'].each { |x| assert(Mrec::M.constants.include?(x)) }
222
- end
208
+ def test_sub_classes_recursive
209
+ sub_classes = Mrec.sub_classes(Mrec::A)
210
+ assert_equal(2, sub_classes.size)
211
+ [Mrec::B, Mrec::A].each do |x|
212
+ assert(sub_classes.include?(x))
213
+ end
214
+ sub_classes = Mrec.sub_classes(Mrec::A, false, true)
215
+ assert_equal(5, sub_classes.size)
216
+ [Mrec::B, Mrec::A, Mrec::M::C, Mrec::M::D, Mrec::M::E].each do |x|
217
+ assert(sub_classes.include?(x))
218
+ end
219
+ r = Mrec.remove_class(Mrec::A, true)
220
+ assert_equal(5, r.size)
221
+ ['B', 'A', 'M::E', 'M::C', 'M::D'].each do |x|
222
+ assert(r.include?(x))
223
+ end
224
+ assert_equal(3, Mrec.constants.size)
225
+ ['FOO', 'M', 'Z'].each { |x| assert(Mrec.constants.include?(x)) }
226
+ assert_equal(1, Mrec::M.constants.size)
227
+ ['Y'].each { |x| assert(Mrec::M.constants.include?(x)) }
228
+ end
223
229
 
224
- module Tree
225
-
226
- class A; end
227
- class B < A; end
228
- class C < B; end
229
- class D < B; end
230
- class E < A; end
231
- module M
232
- class F < A; end
233
- class G < F; end
234
- class H < D; end
235
- class I < H; end
236
- class J < E; end
237
- class Y; end
238
- end
239
- class Z; end
240
- FOO = 42
230
+ module Tree
231
+
232
+ class A; end
233
+ class B < A; end
234
+ class C < B; end
235
+ class D < B; end
236
+ class E < A; end
237
+ module M
238
+ class F < A; end
239
+ class G < F; end
240
+ class H < D; end
241
+ class I < H; end
242
+ class J < E; end
243
+ class Y; end
244
+ end
245
+ class Z; end
246
+ FOO = 42
241
247
 
242
- end
248
+ end
243
249
 
244
- def test_sub_classes_tree_rec
245
- r = Tree.sub_classes_tree(HierarchyTest::Tree::A, false, true)
246
- ref = {
247
- HierarchyTest::Tree::A => {
248
- HierarchyTest::Tree::M::F => {
249
- HierarchyTest::Tree::M::G => {}
250
- },
251
- HierarchyTest::Tree::B => {
252
- HierarchyTest::Tree::C => {},
253
- HierarchyTest::Tree::D => {
254
- HierarchyTest::Tree::M::H => {
255
- HierarchyTest::Tree::M::I=>{}
250
+ def test_sub_classes_tree_rec
251
+ r = Tree.sub_classes_tree(HierarchyTest::Tree::A, false, true)
252
+ ref = {
253
+ HierarchyTest::Tree::A => {
254
+ HierarchyTest::Tree::M::F => {
255
+ HierarchyTest::Tree::M::G => {}
256
+ },
257
+ HierarchyTest::Tree::B => {
258
+ HierarchyTest::Tree::C => {},
259
+ HierarchyTest::Tree::D => {
260
+ HierarchyTest::Tree::M::H => {
261
+ HierarchyTest::Tree::M::I=>{}
262
+ }
263
+ }
264
+ },
265
+ HierarchyTest::Tree::E=> {
266
+ HierarchyTest::Tree::M::J=>{}
256
267
  }
257
268
  }
258
- },
259
- HierarchyTest::Tree::E=> {
260
- HierarchyTest::Tree::M::J=>{}
261
269
  }
262
- }
263
- }
264
- d = r.diff(ref)
265
- assert_equal({}, d[:different])
266
- assert_equal({}, d[:additional])
267
- assert_equal({}, d[:missing])
268
- end
269
-
270
- def test_sub_classes_tree
271
- r = Tree.sub_classes_tree(HierarchyTest::Tree::A)
272
- ref = {
273
- HierarchyTest::Tree::A => {
274
- HierarchyTest::Tree::B => {
275
- HierarchyTest::Tree::D => {},
276
- HierarchyTest::Tree::C => {}
277
- },
278
- HierarchyTest::Tree::E => {}
279
- }
280
- }
281
- d = r.diff(ref)
282
- assert_equal({}, d[:different])
283
- assert_equal({}, d[:additional])
284
- assert_equal({}, d[:missing])
285
- end
286
-
287
- module Error
288
- module M; end
289
- end
270
+ d = r.diff(ref)
271
+ assert_equal({}, d[:different])
272
+ assert_equal({}, d[:additional])
273
+ assert_equal({}, d[:missing])
274
+ end
290
275
 
291
- def test_sub_classes_error
292
- assert_raises(TypeError) do
293
- Error.sub_classes_tree(HierarchyTest::Error::M)
294
- end
295
- assert_raises(TypeError) do
296
- Error.sub_classes(HierarchyTest::Error::M)
297
- end
298
- assert_raises(TypeError) do
299
- Error.remove_class(HierarchyTest::Error::M)
300
- end
301
- end
276
+ def test_sub_classes_tree
277
+ r = Tree.sub_classes_tree(HierarchyTest::Tree::A)
278
+ ref = {
279
+ HierarchyTest::Tree::A => {
280
+ HierarchyTest::Tree::B => {
281
+ HierarchyTest::Tree::D => {},
282
+ HierarchyTest::Tree::C => {}
283
+ },
284
+ HierarchyTest::Tree::E => {}
285
+ }
286
+ }
287
+ d = r.diff(ref)
288
+ assert_equal({}, d[:different])
289
+ assert_equal({}, d[:additional])
290
+ assert_equal({}, d[:missing])
291
+ end
302
292
 
303
- module RemoveClass
304
-
305
- class A; end
306
- class B < A; end
307
- class C < B; end
308
- class D < B; end
309
- class E < D; end
310
- class F < A; end
311
- class Z; end
312
- module M
313
- class Y; end
314
- end
315
- BAR = 51
293
+ module Error
294
+ module M; end
295
+ end
316
296
 
317
- end
297
+ def test_sub_classes_error
298
+ assert_raise(TypeError) do
299
+ Error.sub_classes_tree(HierarchyTest::Error::M)
300
+ end
301
+ assert_raise(TypeError) do
302
+ Error.sub_classes(HierarchyTest::Error::M)
303
+ end
304
+ assert_raise(TypeError) do
305
+ Error.remove_class(HierarchyTest::Error::M)
306
+ end
307
+ end
318
308
 
319
- def test_remove_class
320
- r = RemoveClass.remove_class(HierarchyTest::RemoveClass::B)
321
- assert_equal(4, r.size)
322
- ['B', 'D', 'E', 'C'].each { |x| assert(r.include?(x)) }
323
- assert_equal(5, RemoveClass.constants.size)
324
- ['A', 'F', 'Z', 'M', 'BAR'].each do |x|
325
- assert(RemoveClass.constants.include?(x))
326
- end
327
- end
309
+ module RemoveClass
310
+
311
+ class A; end
312
+ class B < A; end
313
+ class C < B; end
314
+ class D < B; end
315
+ class E < D; end
316
+ class F < A; end
317
+ class Z; end
318
+ module M
319
+ class Y; end
320
+ end
321
+ BAR = 51
328
322
 
329
- end # class HierarchyTest
323
+ end
330
324
 
325
+ def test_remove_class
326
+ r = RemoveClass.remove_class(HierarchyTest::RemoveClass::B)
327
+ assert_equal(4, r.size)
328
+ ['B', 'D', 'E', 'C'].each { |x| assert(r.include?(x)) }
329
+ assert_equal(5, RemoveClass.constants.size)
330
+ ['A', 'F', 'Z', 'M', 'BAR'].each do |x|
331
+ assert(RemoveClass.constants.include?(x))
332
+ end
333
+ end
331
334
 
332
- end
335
+ end # class HierarchyTest
333
336
 
337
+ end
334
338
 
339
+ end # module Hierarchy