summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-31 08:58:59 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-31 08:58:59 +0000
commit32e4d034ca81bffeb6415379eb91a4e90254c886 (patch)
tree1ed8dd47e10d06bd93c97206943e8bf3731adc0f /test/ruby
parentedacfadad6dc07801adcfedab4ca901775ecd909 (diff)
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
Diffstat (limited to 'test/ruby')
-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 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