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:
parent
3e0819c66a
commit
bc2a1f2a98
7 changed files with 40 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue