summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2020-02-13 03:28:40 +0900
committerKoichi Sasada <ko1@atdot.net>2020-02-13 03:30:22 +0900
commit99a8742067ba262eb324615bfac770d1aea53b07 (patch)
tree1c44bdd97466d9571bf171d2a97c7ecfc08ff0bf /test
parentbc1dbed16c647c556725481e38fc2e857e162fd6 (diff)
should be compared with called_id
me->called_id and me->def->original_id can be different sometimes so we should compare with called_id, which is mtbl's key. (fix GH-PR #2869)
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_super.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb
index 7c4beff..3d5af3d 100644
--- a/test/ruby/test_super.rb
+++ b/test/ruby/test_super.rb
@@ -585,15 +585,22 @@ class TestSuper < Test::Unit::TestCase
end
def test_super_with_define_method
- superklass = Class.new do
+ superklass1 = Class.new do
def foo; :foo; end
def bar; :bar; end
+ def boo; :boo; end
end
- subklass = Class.new(superklass)
- [:foo, :bar].each do |sym|
+ superklass2 = Class.new(superklass1) do
+ alias baz boo
+ def boo; :boo2; end
+ end
+ subklass = Class.new(superklass2)
+ [:foo, :bar, :baz, :boo].each do |sym|
subklass.define_method(sym){ super() }
end
assert_equal :foo, subklass.new.foo
assert_equal :bar, subklass.new.bar
+ assert_equal :boo, subklass.new.baz
+ assert_equal :boo2, subklass.new.boo
end
end