mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-06-17 23:25:42 +08:00
add test for Hash.new{} leak
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user