mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
1 changed files with 16 additions and 1 deletions
|
@ -1069,7 +1069,7 @@ class TestModule < Test::Unit::TestCase
|
|||
assert_in_out_err([], src, ["NameError"], [])
|
||||
end
|
||||
|
||||
def test_mix
|
||||
def test_mix_method
|
||||
american = Module.new do
|
||||
attr_accessor :address
|
||||
end
|
||||
|
@ -1112,4 +1112,19 @@ class TestModule < Test::Unit::TestCase
|
|||
}
|
||||
}
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue