summaryrefslogtreecommitdiff
path: root/test/ruby/test_refinement.rb
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-27 08:06:50 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-27 08:06:50 +0000
commitd604893f2065b3797218aa0607b3c21a13c82160 (patch)
tree85c1d04b9aa6c4af63a3d56248a8a2615950f817 /test/ruby/test_refinement.rb
parent169ec127e0197bad550e9b2902f4c715d0c0b7a6 (diff)
merge revision(s) 49221: [Backport #10731]
* vm_method.c (rb_alias): raise a NameError when creating alias to a refined method if the original method of the refined method is not defined. [ruby-core:67523] [Bug #10731] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@49425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_refinement.rb')
-rw-r--r--test/ruby/test_refinement.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb
index a98d3332bf..d4a8645db5 100644
--- a/test/ruby/test_refinement.rb
+++ b/test/ruby/test_refinement.rb
@@ -1016,6 +1016,31 @@ class TestRefinement < Test::Unit::TestCase
end;
end
+ def test_alias_refined_method
+ assert_separately(['-W0'], <<-"end;")
+ bug10731 = '[ruby-core:67523] [Bug #10731]'
+
+ class C
+ end
+
+ module RefinementBug
+ refine C do
+ def foo
+ end
+
+ def bar
+ end
+ end
+ end
+
+ assert_raise(NameError, bug10731) do
+ class C
+ alias foo bar
+ end
+ end
+ end;
+ end
+
private
def eval_using(mod, s)