I'm having issues unit testing code involving an isKindOfClass
check. There are a lot of existing question on this topic and the answers recommend:
- Make sure
-ObjC
is included as an "other linker flag". It is. - Make sure the
.m
files from the project target are not added to the test target. They aren't. - ...?
To make sure there weren't odd circumstances, I created a fresh project. I:
- Created an "Empty Application" project
- Added a PodFile referencing
"TwistedOakCollapsingFutures"
- Ran
pod install
- Opened the workspace
- Verified
-ObjC
is present in both targets - Added a method returning
[TOCFuture futureWithResult:@1]
toAppDelegate.m
- Added
XCTAssert([AppDelegate.makeFuture isKindOfClass:TOCFuture.class], @"")
to the example test - Ran the unit tests (the assert failed)
Basically I have no idea why this shouldn't work. Even more oddly, if I go counter to existing answers and include AppDelegate.m
in the test target, the test starts to pass.
What is going on? Am I suppose to include the source files in the test target, or am I not supposed to?