mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
An alias can suppress method redefinition warning
This commit is contained in:
parent
6a6227e016
commit
7ff1bf3178
1 changed files with 11 additions and 0 deletions
|
@ -253,4 +253,15 @@ class TestAlias < Test::Unit::TestCase
|
||||||
assert_equal(:foo, k.instance_method(:bar).original_name)
|
assert_equal(:foo, k.instance_method(:bar).original_name)
|
||||||
assert_equal(:foo, name)
|
assert_equal(:foo, name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_alias_suppressing_redefinition
|
||||||
|
assert_in_out_err(%w[-w], "#{<<~"begin;"}\n#{<<~'end;'}")
|
||||||
|
begin;
|
||||||
|
class A
|
||||||
|
def foo; end
|
||||||
|
alias foo foo
|
||||||
|
def foo; end
|
||||||
|
end
|
||||||
|
end;
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue