diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-05 02:57:40 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-05 02:57:40 +0000 |
commit | 95fd4eda53b904dfe5be44f19fb774229f358b10 (patch) | |
tree | 11440dd22e287cb93eb20c3e1f8a9a71d4516caf /test | |
parent | aafdba6be57cd64f9c24c741c6d40c500d022673 (diff) | |
download | ruby-95fd4eda53b904dfe5be44f19fb774229f358b10.tar.gz |
* test/ruby/test_refinement.rb (test_refine_alias_in_subclass):
add a test to check that alias in subclasses can be refined.
[ruby-core:69374] [Bug #11186]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_refinement.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb index 3b3ceb048c..5cbb11121b 100644 --- a/test/ruby/test_refinement.rb +++ b/test/ruby/test_refinement.rb @@ -1750,6 +1750,31 @@ class TestRefinement < Test::Unit::TestCase assert_equal("Foo#x", FooExtClient.return_proc(&:x).(Foo.new)) end + module AliasInSubclass + class C + def foo + :original + end + end + + class D < C + alias bar foo + end + + module M + refine D do + def bar + :refined + end + end + end + end + + def test_refine_alias_in_subclass + assert_equal(:refined, + eval_using(AliasInSubclass::M, "AliasInSubclass::D.new.bar")) + end + private def eval_using(mod, s) |