• 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
#ifdef in tests
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

#ifdef in tests


  • Subject: #ifdef in tests
  • From: "Reaves, Timothy" <email@hidden>
  • Date: Sun, 22 Apr 2012 11:25:02 -0400

I have this code in my app delegate:
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator
{
#ifdef TEST
    return mockPersistentStoreCoordinator;
#else
    return realPersistentStoreCoordinator;
#endif
}

The intention is to return a different NSPersistentStoreCoordinator based on if this is the tests target, and the Test scheme.  I have a Test.pch for my test target, that defines TEST.  The pch file also has some imports.  My tests import this file, as they would not compile otherwise. The problem is, my app delegate does not.  When I set a breakpoint, it always hits the second line.

I have tried to add -DTEST to the 'Other C Flags', and it still does not hit.  I've cleaned the code, all to no avail.   If I ad this code to one of my tests, it does hit there.  So how do I actually get my application code to see the value, either in the PCH file or in the 'Other C Flags' area?   This should be a very simple configuration issue. 

Thanks.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: #ifdef in tests
      • From: Jean-Denis MUYS <email@hidden>
  • Prev by Date: Storyboard stuck in XML in Xcode 4.2
  • Next by Date: glibtool + Xcode 4
  • Previous by thread: Storyboard stuck in XML in Xcode 4.2
  • Next by thread: Re: #ifdef in tests
  • Index(es):
    • Date
    • Thread