* test/ruby/test_module.rb (TestModule#test_mix_const): test for
constant mix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
40930b7144
commit
bf1a04b191
@ -1069,7 +1069,7 @@ class TestModule < Test::Unit::TestCase
|
|||||||
assert_in_out_err([], src, ["NameError"], [])
|
assert_in_out_err([], src, ["NameError"], [])
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_mix
|
def test_mix_method
|
||||||
american = Module.new do
|
american = Module.new do
|
||||||
attr_accessor :address
|
attr_accessor :address
|
||||||
end
|
end
|
||||||
@ -1112,4 +1112,19 @@ class TestModule < Test::Unit::TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_mix_const
|
||||||
|
foo = Module.new do
|
||||||
|
const_set(:D, 55)
|
||||||
|
end
|
||||||
|
bar = Class.new do
|
||||||
|
const_set(:D, 42)
|
||||||
|
end
|
||||||
|
assert_nothing_raised(ArgumentError) {
|
||||||
|
bar.class_eval {
|
||||||
|
mix foo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assert_equal(42, bar::D)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user