add test for Hash.new{} leak

This commit is contained in:
Laurent Sansonetti
2013-07-13 14:41:37 +02:00
parent 7cf7ec7e33
commit ff32d809d6

View File

@@ -212,3 +212,20 @@ describe "self" do
$test_dealloc.should == true
end
end
describe "Hash.new {}" do
class TestObjectDealloc
def dealloc
$test_dealloc = true
super
end
end
it "does not leak memory" do
$test_dealloc = false
autorelease_pool do
h = Hash.new { |h, k| h[k] = [] }
h['1'] << TestObjectDealloc.new
end
$test_dealloc.should == true
end
end