summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-20 12:22:17 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-20 12:22:17 +0000
commit4b72c61d46d0e6a27b8b48865d539ed50c804850 (patch)
treee92a49ed3e4313971fb850a0b86229a528c38bb5 /test
parente7ee0b13d63325254c8efae2fe4d7c5d9a909608 (diff)
merge revision(s) r45350: [Backport #9645]
* variable.c (rb_const_set): delete existing entry on redefinition [Bug #9645] * test/ruby/test_const.rb (test_redefinition): test for leak git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@45373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_const.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_const.rb b/test/ruby/test_const.rb
index dab45b7e08..c4a4d93249 100644
--- a/test/ruby/test_const.rb
+++ b/test/ruby/test_const.rb
@@ -1,5 +1,6 @@
# -*- coding: us-ascii -*-
require 'test/unit'
+require_relative 'envutil'
class TestConst < Test::Unit::TestCase
TEST1 = 1
@@ -54,5 +55,12 @@ class TestConst < Test::Unit::TestCase
#{__FILE__}:#{__LINE__-1}: warning: already initialized constant #{c}::X
#{__FILE__}:#{__LINE__-3}: warning: previous definition of X was here
WARNING
+ code = <<-PRE
+olderr = $stderr.dup
+$stderr.reopen(File::NULL, "wb")
+350000.times { FOO = :BAR }
+$stderr.reopen(olderr)
+PRE
+ assert_no_memory_leak([], '', code, 'redefined constant')
end
end