Re: #ifdef in tests
Re: #ifdef in tests
- Subject: Re: #ifdef in tests
- From: Jean-Denis MUYS <email@hidden>
- Date: Wed, 25 Apr 2012 07:17:46 +0000
- Thread-topic: #ifdef in tests
On 22 avr. 2012, at 17:25, Reaves, Timothy wrote:
> 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.
I define my preprocessor symbols in a project (or target) setting named… "Preprocessor macros", that can be tailored to each build configuration. It can be found under the "Preprocessing" setting category.
Jean-Denis
_______________________________________________
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