• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
UnitTest: object Should be Dealllocated
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

UnitTest: object Should be Dealllocated


  • Subject: UnitTest: object Should be Dealllocated
  • From: Andreas Grosam <email@hidden>
  • Date: Wed, 26 Jun 2013 15:15:55 +0200

There is a class whose implementation may be prone to accidentally have a _strong_ reference elsewhere (namely within a block), which effectively prevents the object to be deallocated in certain scenarios when it should.

When carefully implemented that doesn't happen, though.


How can I create a Unit Test which tests such cases, e.g.:

Foo* foo;
@autoreleaspool {
    foo = [Foo new];
    [foo doSomething];
    foo = nil;   // should deallocate foo
}
ASSERT_DEALLOCATED_TRUE(foo);


Of course, the "doSomething" is more complicated involving possibly suspended dispatch queues and blocks, etc.



Thanks for tips!


Andreas
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: UnitTest: object Should be Dealllocated
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Re: Still can't delete CoreData object
  • Next by Date: Re: Core Data Reverse Engineering KickStarter Project
  • Previous by thread: Affects of [interior]BackgroundStyle
  • Next by thread: Re: UnitTest: object Should be Dealllocated
  • Index(es):
    • Date
    • Thread