mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-03-27 22:56:48 +08:00
[memory] Add failing test case for RM-650.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user