diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-09-29 06:26:46 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-09-29 06:26:46 +0000 |
| commit | 19633f34bde578a4454adfb8ec117cb14abc63e9 (patch) | |
| tree | 6401aca96ce430d29d35400402122a78bcb09a7b /test/ruby/test_module.rb | |
| parent | 69ef950b44c7db195254c8962d9f3b759769827b (diff) | |
| download | ruby-19633f34bde578a4454adfb8ec117cb14abc63e9.tar.gz ruby-19633f34bde578a4454adfb8ec117cb14abc63e9.tar.xz ruby-19633f34bde578a4454adfb8ec117cb14abc63e9.zip | |
* test/ruby/test_{class,module}.rb (test_method_redefinition): refined.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_module.rb')
| -rw-r--r-- | test/ruby/test_module.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index 0588f4683..8829a3dcf 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -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 |
