From 32e4d034ca81bffeb6415379eb91a4e90254c886 Mon Sep 17 00:00:00 2001 From: naruse Date: Fri, 31 Jan 2014 08:58:59 +0000 Subject: merge revision(s) 44455,44458,44510: [Backport #9349] * 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_1@44777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_super.rb | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb index 846f40946d..c5f724ebb8 100644 --- a/test/ruby/test_super.rb +++ b/test/ruby/test_super.rb @@ -407,4 +407,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 -- cgit v1.2.3