diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-09-03 15:11:53 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-09-03 15:11:53 +0000 |
commit | bc2a1f2a98b04f040ea485cedd3283f2f3906e4c (patch) | |
tree | 833ab2f599dfd7576201ab5745e7ffeb5436fd88 /test | |
parent | 3e0819c66a0908be61fbb769e96c1accb1d67f26 (diff) |
* variable.c (rb_const_set): show the previous definition
location. [EXPERIMENTAL]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_const.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_const.rb b/test/ruby/test_const.rb index 3708a5a0ca..31adb2a0ce 100644 --- a/test/ruby/test_const.rb +++ b/test/ruby/test_const.rb @@ -45,4 +45,13 @@ class TestConst < Test::Unit::TestCase assert defined?(TEST4) assert_equal 8, TEST4 end + + def test_redefinition + c = Class.new + c.const_set(:X, 1) + assert_output(nil, <<-WARNING) {c.const_set(:X, 2)} +#{__FILE__}:#{__LINE__-1}: warning: already initialized constant X +#{__FILE__}:#{__LINE__-3}: warning: previous definition of X was here +WARNING + end end |