From 639eff2ea7738cbaca771a8fb8e2e20dde1585e3 Mon Sep 17 00:00:00 2001 From: nagachika Date: Mon, 14 Nov 2016 17:59:42 +0000 Subject: merge revision(s) 56520: [Backport #12876] * vm_eval.c (vm_call0_body): follow the original class, not to loop the prepended module. [ruby-core:77784] [Bug #12876] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@56783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_super.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test') diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb index 06e3e6e3b5..2764cf534b 100644 --- a/test/ruby/test_super.rb +++ b/test/ruby/test_super.rb @@ -530,4 +530,18 @@ class TestSuper < Test::Unit::TestCase assert_equal "b", b.new.foo{"c"} end + + def test_public_zsuper_with_prepend + bug12876 = '[ruby-core:77784] [Bug #12876]' + m = EnvUtil.labeled_module("M") + c = EnvUtil.labeled_class("C") {prepend m; public :initialize} + o = assert_nothing_raised(Timeout::Error, bug12876) { + Timeout.timeout(3) {c.new} + } + assert_instance_of(c, o) + m.module_eval {def initialize; raise "exception in M"; end} + assert_raise_with_message(RuntimeError, "exception in M") { + c.new + } + end end -- cgit v1.2.3