summaryrefslogtreecommitdiff
path: root/test/ruby/test_super.rb
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2020-01-18 18:18:00 -0800
committer卜部昌平 <shyouhei@ruby-lang.org>2020-02-13 00:14:55 +0900
commited7b46b66be671165b6f38abd21d7638f4dfdcea (patch)
tree69dacc5327b52842c8999b7c4bc1f1d823519da4 /test/ruby/test_super.rb
parenta91ce05046b1bddc60a3dafcea59a4366359dffa (diff)
Use inline cache for super calls
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2869
Diffstat (limited to 'test/ruby/test_super.rb')
-rw-r--r--test/ruby/test_super.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb
index bbfc581500..7c4beff07b 100644
--- a/test/ruby/test_super.rb
+++ b/test/ruby/test_super.rb
@@ -583,4 +583,17 @@ class TestSuper < Test::Unit::TestCase
def test_super_with_modified_rest_parameter
assert_equal [13], TestFor_super_with_modified_rest_parameter.new.foo
end
+
+ def test_super_with_define_method
+ superklass = Class.new do
+ def foo; :foo; end
+ def bar; :bar; end
+ end
+ subklass = Class.new(superklass)
+ [:foo, :bar].each do |sym|
+ subklass.define_method(sym){ super() }
+ end
+ assert_equal :foo, subklass.new.foo
+ assert_equal :bar, subklass.new.bar
+ end
end