summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-19 13:08:28 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-19 13:08:28 +0000
commit59270c607bb4dd053bb4b6ecc0719de011a0eb55 (patch)
tree6b2a82a1e99732b9e718416d64ad8b1d5faedf56 /test
parent4c3d694fb418363a37ea12926222d4c4bb37a044 (diff)
class.c: prepend for each classes
* class.c (include_modules_at): allow prepend each modules upto once for each classes. [EXPERIMENTAL] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_module.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 9d6e13d..8413c47 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -1725,6 +1725,17 @@ class TestModule < Test::Unit::TestCase
assert_equal('hello!', foo.new.hello, bug9236)
end
+ def test_multiple_prepend
+ m = labeled_module("M")
+ c1 = labeled_class("C1") {
+ prepend m
+ }
+ c2 = labeled_class("C2", c1) {
+ prepend m
+ }
+ assert_equal([m, c2, m, c1], c2.ancestors[0, 4])
+ end
+
def test_class_variables
m = Module.new
m.class_variable_set(:@@foo, 1)