mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/ruby/test_{class,module}.rb (test_method_redefinition): refined.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f5654b4dfc
commit
e6fb96e691
3 changed files with 71 additions and 20 deletions
|
@ -786,4 +786,32 @@ class TestModule < Test::Unit::TestCase
|
|||
assert_equal [:f, :g, :a, :a=], memo.shift
|
||||
assert_equal mod.instance_method(:a=), memo.shift
|
||||
end
|
||||
|
||||
def test_method_redefinition
|
||||
stderr = EnvUtil.verbose_warning do
|
||||
Module.new do
|
||||
def foo; end
|
||||
def foo; end
|
||||
end
|
||||
end
|
||||
assert_match(/method redefined; discarding old foo/, stderr)
|
||||
|
||||
stderr = EnvUtil.verbose_warning do
|
||||
Module.new do
|
||||
def foo; end
|
||||
alias bar foo
|
||||
alias bar foo
|
||||
end
|
||||
end
|
||||
assert_equal("", stderr)
|
||||
|
||||
stderr = EnvUtil.verbose_warning do
|
||||
Module.new do
|
||||
module_function
|
||||
def foo; end
|
||||
module_function :foo
|
||||
end
|
||||
end
|
||||
assert_equal("", stderr, '[ruby-dev:39397]')
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue