From 59270c607bb4dd053bb4b6ecc0719de011a0eb55 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 19 Jan 2015 13:08:28 +0000 Subject: 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 --- test/ruby/test_module.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test') diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index 9d6e13d676..8413c4782b 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) -- cgit v1.2.3