summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-08-07 02:44:24 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-08-07 02:44:24 +0000
commit0f24f944705a3899f57f4c36f0a74d9438a09359 (patch)
tree36685f92c3d77042ee7f7422c18f9a316baf08ca /test/ruby
parentb361d7d0820592d0cdb2c72a257be0a29c04a4ef (diff)
* vm_method.c (rb_redefine_opt_method): use RCLASS_ORIGIN to avoid
SEGV when a module-prepended class is refined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_refinement.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb
index 65789899c5..cc460894c4 100644
--- a/test/ruby/test_refinement.rb
+++ b/test/ruby/test_refinement.rb
@@ -300,5 +300,29 @@ class TestRefinement < Test::Unit::TestCase
assert_equal("m2#bar", m.call_bar("abc"))
assert_equal("m3#baz", m.call_baz("abc"))
end
+
+ def test_refine_prepended_class
+ m1 = Module.new {
+ def foo
+ super << :m1
+ end
+ }
+ c = Class.new {
+ prepend m1
+
+ def foo
+ [:c]
+ end
+ }
+ m2 = Module.new {
+ refine c do
+ def foo
+ super << :m2
+ end
+ end
+ }
+ obj = c.new
+ assert_equal([:c, :m1, :m2], m2.module_eval { obj.foo })
+ end
end