summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-14 08:20:10 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-14 08:20:10 +0000
commit160b67df68655322d09f566914c89e2d3e7cfc05 (patch)
tree08adf254d814eae020422f183addabdbf9cec95b /test/ruby
parentc2a7a091cc8cf9352a6df05591788b6a8c0134ad (diff)
proc.c: use already included ancestor iclass
* proc.c (umethod_bind): use the ancestor iclass instead of new iclass to get rid of infinite recursion, if the defined module is already included. [ruby-core:62014] [Bug #9721] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_super.rb19
1 files changed, 18 insertions, 1 deletions
diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb
index e7825560ac..bea490d0cd 100644
--- a/test/ruby/test_super.rb
+++ b/test/ruby/test_super.rb
@@ -469,11 +469,28 @@ class TestSuper < Test::Unit::TestCase
end
end
- m = b.instance_method(:foo).bind(Object.new.extend(a))
+ um = b.instance_method(:foo)
+
+ m = um.bind(Object.new.extend(a))
result = []
assert_nothing_raised(NoMethodError, bug9721) do
m.call(result)
end
assert_equal(%w[B A], result, bug9721)
+
+ bug9740 = '[ruby-core:62017] [Bug #9740]'
+
+ b.module_eval do
+ define_method(:foo) do |result|
+ um.bind(self).call(result)
+ end
+ end
+
+ result.clear
+ o = Object.new.extend(a).extend(b)
+ assert_nothing_raised(NoMethodError, SystemStackError, bug9740) do
+ o.foo(result)
+ end
+ assert_equal(%w[B A], result, bug9721)
end
end