diff options
Diffstat (limited to 'test/ruby/test_inlinecache.rb')
| -rw-r--r-- | test/ruby/test_inlinecache.rb | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/test/ruby/test_inlinecache.rb b/test/ruby/test_inlinecache.rb index 90d0189d4c..d48d95d74e 100644 --- a/test/ruby/test_inlinecache.rb +++ b/test/ruby/test_inlinecache.rb @@ -3,7 +3,7 @@ require 'test/unit' -class TestMethod < Test::Unit::TestCase +class TestMethodInlineCache < Test::Unit::TestCase def test_alias m0 = Module.new do def foo; :M0 end @@ -61,4 +61,50 @@ class TestMethod < Test::Unit::TestCase assert_equal :E, test[] EOS end + + def test_module_methods_redefiniton + m0 = Module.new do + def foo + super + end + end + + c1 = Class.new do + def foo + :C1 + end + end + + c2 = Class.new do + def foo + :C2 + end + end + + d1 = Class.new(c1) do + include m0 + end + + d2 = Class.new(c2) do + include m0 + end + + assert_equal :C1, d1.new.foo + + m = Module.new do + def foo + super + end + end + + d1.class_eval do + include m + end + + d2.class_eval do + include m + end + + assert_equal :C2, d2.new.foo + end end |
