summaryrefslogtreecommitdiff
path: root/test/ruby/test_refinement.rb
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-17 17:34:01 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-17 17:34:01 +0000
commit585287338ed2eb6f1443d838911632eff243a998 (patch)
tree1ebf4ba0437562b3a0fac5b1efcaf4709baf61c7 /test/ruby/test_refinement.rb
parent838f246282511b4b64b70d1427716edcc739da0d (diff)
merge revision(s) r49685,r49687: [Backport #10885]
* vm_insnhelper.c (rb_vm_rewrite_cref_stack): copy nd_refinements of orignal crefs. It fixes segmentation fault when calling refined method in duplicate module. [ruby-dev:48878] [Bug #10885] * vm_core.h, class.c: change accordingly. * test/ruby/test_refinement.rb: add a test for above. of original crefs. It fixes segmentation fault when calling git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@49995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_refinement.rb')
-rw-r--r--test/ruby/test_refinement.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb
index dc2d31c867..d9b166317b 100644
--- a/test/ruby/test_refinement.rb
+++ b/test/ruby/test_refinement.rb
@@ -1358,6 +1358,34 @@ class TestRefinement < Test::Unit::TestCase
:foo, bug10826)
end
+ def test_call_refined_method_in_duplicate_module
+ bug10885 = '[ruby-dev:48878]'
+ assert_in_out_err([], <<-INPUT, [], [], bug10885)
+ module M
+ refine Object do
+ def raise
+ # do nothing
+ end
+ end
+
+ class << self
+ using M
+ def m0
+ raise
+ end
+ end
+
+ using M
+ def M.m1
+ raise
+ end
+ end
+
+ M.dup.m0
+ M.dup.m1
+ INPUT
+ end
+
private
def eval_using(mod, s)