mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
8afd5857f0
commit
8b54e69482
2 changed files with 31 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Sat Nov 5 11:53:02 2016 Shugo Maeda <shugo@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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]
|
||||||
|
|
||||||
Sat Nov 5 11:20:57 2016 Shugo Maeda <shugo@ruby-lang.org>
|
Sat Nov 5 11:20:57 2016 Shugo Maeda <shugo@ruby-lang.org>
|
||||||
|
|
||||||
* cont.c (cont_new): disable optimization if clang's version is
|
* cont.c (cont_new): disable optimization if clang's version is
|
||||||
|
|
|
@ -1750,6 +1750,31 @@ class TestRefinement < Test::Unit::TestCase
|
||||||
assert_equal("Foo#x", FooExtClient.return_proc(&:x).(Foo.new))
|
assert_equal("Foo#x", FooExtClient.return_proc(&:x).(Foo.new))
|
||||||
end
|
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
|
private
|
||||||
|
|
||||||
def eval_using(mod, s)
|
def eval_using(mod, s)
|
||||||
|
|
Loading…
Add table
Reference in a new issue