diff options
author | Koichi Sasada <[email protected]> | 2020-12-19 04:30:25 +0900 |
---|---|---|
committer | Koichi Sasada <[email protected]> | 2020-12-19 04:33:04 +0900 |
commit | cee02d754d76563635c1db90d2ab6c01f8492470 (patch) | |
tree | 115c68c2708aabb557243868cb870fe55b811e64 /test | |
parent | 04d62e6f6202684c57f2fcf71bbfcb891cd4ddd9 (diff) |
fix refinements/prepend bug
replaced method entry should be invalidated.
[Bug #17386]
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_refinement.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb index 61ad2d92e7..b27a176889 100644 --- a/test/ruby/test_refinement.rb +++ b/test/ruby/test_refinement.rb @@ -2446,4 +2446,31 @@ class TestRefinement < Test::Unit::TestCase def eval_using(mod, s) eval("using #{mod}; #{s}", Sandbox::BINDING) end + + # [Bug #17386] + def test_prepended_with_method_cache + foo = Class.new do + def foo + :Foo + end + end + + code = Module.new do + def foo + :Code + end + end + + _ext = Module.new do + refine foo do + def foo; end + end + end + + obj = foo.new + + assert_equal :Foo, obj.foo + foo.prepend code + assert_equal :Code, obj.foo + end end |