I have the following stupidly simple test case (defined in a .mm file with correspong .h file). It uses boost to try to read in a ptree from a stringstream to simulate the text that would be in a file.
-(void)setUp {
printf("setup\n");
::std::stringstream ss;
ss << "bad format text";
_configuration = new ptree();
::boost::property_tree::read_json(ss, *_configuration);
}
The tearDown function does nothing, and there is one test case, which also does nothing. If I comment out the read_json line, everything works fine. But if I run it as is, I get:
Test Case '-[TestPlanner testPlanner]' started.
libc++abi.dylib: terminate called throwing an exception
/Applications/Xcode.app/Contents/Developer/Tools/RunPlatformUnitTests.include: line 415: 3320 Abort trap: 6 "${THIN_TEST_RIG}" "${OTHER_TEST_FLAGS}" "${TEST_BUNDLE_PATH}"
/Applications/Xcode.app/Contents/Developer/Tools/RunPlatformUnitTests.include:451: error: Test rig '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk/Developer/usr/bin/otest' exited abnormally with code 134 (it may have crashed).
The really crazy thing is that if I set a breakpoint in the SetUp function, it doesn't even run! And this is the only test enabled, so without even running a single line of a single test, something crashes. I know the test is set up correctly, because if I comment out the read_json line and set a breakpoint, it does get reached, and I can include some asserts in the test case and they work as expected.
It's not just a boost problem either. I originally encountered this when calling a different library from my own project, but to simplify everything I went down to just this boost call. This exact same call is happening in other parts of the code, so I'm pretty sure I have boost linked in correctly. I was super verbose with namespaces, so I don't think I'm linking the wrong version of a function or something.
I'm running XCode 4.5 (but have the same problem on 4.4.1) and trying to write Unit tests using OCUnit. The project I am working on already has a few unit tests written in this framework and everything with those tests seems to work fine.
I'm new to Objective C and XCode but the guy who set this project up definitely isn't and he couldn't see any problem with what I was doing and we were both totally stumped.
Thanks for reading! Let me know if you need any more info.