From b41c77d994592ac45123b99619fd0bedc5cc002f Mon Sep 17 00:00:00 2001 From: Watson Date: Fri, 13 Dec 2013 23:36:53 +0900 Subject: [PATCH] add test for RM-351 --- test/test/spec/memory_spec.rb | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/test/test/spec/memory_spec.rb b/test/test/spec/memory_spec.rb index 6a6f92ad..f64290ad 100644 --- a/test/test/spec/memory_spec.rb +++ b/test/test/spec/memory_spec.rb @@ -433,7 +433,6 @@ describe "Range" do end end -# RM-350 describe "Hash" do class TestHash def initialize @@ -448,8 +447,18 @@ describe "Hash" do @fields[:foo] = "foo" end + + def test_hash_clear + foo = @fields[:foo] + @fields.clear + + foo.inspect + + @fields[:foo] = "foo" + end end + # RM-350 it "#[]= should not released the object" do @foo = TestHash.new @@ -461,6 +470,20 @@ describe "Hash" do # test_hash_aset should not cause a crash 1.should == 1 end + + # RM-351 + it "#clear should not released the object" do + @foo = TestHash.new + + 5.times do + @foo.performSelectorOnMainThread(:'test_hash_clear', withObject:nil, waitUntilDone:false) + NSRunLoop.currentRunLoop.runUntilDate(NSDate.dateWithTimeIntervalSinceNow(0.2)) + end + + # test_hash_clear should not cause a crash + 1.should == 1 + end + end # RM-290