diff options
author | Koichi Sasada <[email protected]> | 2021-02-19 14:57:59 +0900 |
---|---|---|
committer | Koichi Sasada <[email protected]> | 2021-02-19 16:54:31 +0900 |
commit | 9c769575bfa2a5c9e7078eb2840bba640dc46077 (patch) | |
tree | 40447e43ba4afc6972c55d9089b30a5b2c00a264 /test/ruby/test_method_cache.rb | |
parent | d260cbe2950392c41e263c82ab753e5faa12468c (diff) |
invalidate negative cache any time.
negative cache on a class which does not have subclasses was not
invalidated, but it should be invalidated because other classes
can cache this negative cache.
[Bug #17553]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4201
Diffstat (limited to 'test/ruby/test_method_cache.rb')
-rw-r--r-- | test/ruby/test_method_cache.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_method_cache.rb b/test/ruby/test_method_cache.rb index a8e7e22ae3..2ed89e47bf 100644 --- a/test/ruby/test_method_cache.rb +++ b/test/ruby/test_method_cache.rb @@ -61,5 +61,16 @@ class TestMethodCache < Test::Unit::TestCase assert_equal :c2, c3.new.foo end + + def test_negative_cache_with_and_without_subclasses + c0 = Class.new{} + c1 = Class.new(c0){} + c0.new.foo rescue nil + c1.new.foo rescue nil + c1.module_eval{ def foo = :c1 } + c0.module_eval{ def foo = :c0 } + + assert_equal :c0, c0.new.foo + end end |