From 01057405403d8d2e07106934a0fc020062dd28dd Mon Sep 17 00:00:00 2001 From: Watson Date: Sat, 14 Dec 2013 14:21:14 +0900 Subject: [PATCH] add test for RM-354 --- test/test/spec/memory_spec.rb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test/test/spec/memory_spec.rb b/test/test/spec/memory_spec.rb index 7400f3cd..e8303cf6 100644 --- a/test/test/spec/memory_spec.rb +++ b/test/test/spec/memory_spec.rb @@ -507,6 +507,36 @@ describe "Hash" do end end +describe "Array" do + class TestArray + def initialize + @array = ["a", "b", "c"] + end + + def test_array_delete + obj = @array[0] + @array.delete("a") + + obj.inspect + + @array.unshift("a") + end + end + + # RM-354 + it "#delete should not released the object" do + @foo = TestArray.new + + 5.times do + @foo.performSelectorOnMainThread(:'test_array_delete', withObject:nil, waitUntilDone:false) + NSRunLoop.currentRunLoop.runUntilDate(NSDate.dateWithTimeIntervalSinceNow(0.2)) + end + + # test_array_delete should not cause a crash + 1.should == 1 + end +end + # RM-290 describe "NSMutableData" do class NSMutableData