1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
nobu 2011-09-03 15:11:53 +00:00
parent 3e0819c66a
commit bc2a1f2a98
7 changed files with 40 additions and 1 deletions

View file

@ -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