From 2aa849f98cdecf2d16c3d652fe3a76693f166c73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Fri, 31 Oct 2014 19:38:11 +0100 Subject: [PATCH] [memory] Add failing test case for RM-650. --- test/test/spec/memory_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/test/spec/memory_spec.rb b/test/test/spec/memory_spec.rb index 7cb57a57..d6ae511c 100644 --- a/test/test/spec/memory_spec.rb +++ b/test/test/spec/memory_spec.rb @@ -271,6 +271,12 @@ class RetainCounter end end +class OverridesNewOnObjectiveCClass < CALayer + def self.new + super + end +end + describe "Ruby methods that return retained objects" do def newObject; Object.new; end def newbuildObject; Object.new; end @@ -285,6 +291,10 @@ describe "Ruby methods that return retained objects" do newbuildRetainCounter.retain_count.should == 0 end + xit "returns an autoreleased object when overriding `::new` on an Objective-C class" do + lambda { OverridesNewOnObjectiveCClass.new }.should.be.autoreleased + end + it "returns a retained object if the method name starts exactly with 'new' and is called from Objective-C" do TestMethod.isReturnValueRetained(self, forSelector:'newRetainCounter').should == true TestMethod.isReturnValueRetained(self, forSelector:'newbuildRetainCounter').should == false