diff options
Diffstat (limited to 'test/ruby/test_const.rb')
-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 |