mirror of
https://github.com/ruby/ruby.git
synced 2025-09-23 20:44:00 +02:00
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
This commit is contained in:
parent
4c3d694fb4
commit
59270c607b
3 changed files with 29 additions and 14 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue