summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-06 16:35:45 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-06 16:35:45 +0000
commit968b6238d0bd0ef8e185cd4912587df00ac3c9ef (patch)
treeab60d001dc380bfede651372fa8cdab8980af6aa /test
parentc45b8794365d4950cf71f27de5281327f9e65ba7 (diff)
merge revision(s) 44455,44458,44510: [Backport #9315]
* vm_insnhelper.c (vm_search_super_method): direct superclass of a module is found when super called in a Method object generated a method defined in a module, call method_missing in that case. [ruby-core:59358] [Bug #9315] * proc.c (mnew_from_me): keep iclass as-is, to make inheritance chain consistent. [ruby-core:59358] [Bug #9315] * proc.c (method_owner): return the original defined_class from prepended iclass, instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@44511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_super.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb
index 1aab553ebb..a7a3840d50 100644
--- a/test/ruby/test_super.rb
+++ b/test/ruby/test_super.rb
@@ -408,4 +408,37 @@ class TestSuper < Test::Unit::TestCase
assert_equal([false, false], y.foo(false, false))
assert_equal([1, 2, 3, false, 5], y.foo(1, 2, 3, false, 5))
end
+
+ def test_missing_super_in_method_module
+ bug9315 = '[ruby-core:59358] [Bug #9315]'
+ a = Module.new do
+ def foo
+ super
+ end
+ end
+ b = Class.new do
+ include a
+ end
+ assert_raise(NoMethodError, bug9315) do
+ b.new.method(:foo).call
+ end
+ end
+
+ def test_module_super_in_method_module
+ bug9315 = '[ruby-core:59589] [Bug #9315]'
+ a = Module.new do
+ def foo
+ super
+ end
+ end
+ c = Class.new do
+ def foo
+ :ok
+ end
+ end
+ o = c.new.extend(a)
+ assert_nothing_raised(NoMethodError, bug9315) do
+ assert_equal(:ok, o.method(:foo).call, bug9315)
+ end
+ end
end