I want to be able to test library code in the library target so I don't have to switch over to a separate project to run it.
I see how to add a target, but I'm not sure how to set it up to run like the "Command Line Tool" project template does. I tried adding a new "Shell Tool" target, but I don't know how to make it run like one. What build settings do I have to add to that target? What files (main.m?) do I need to start it up?
EDIT (Added my comments from below to hopefully make the question more answerable.)
My library has two targets, one for iOS and one for MacOS. I'm only including it in an iOS project so far, so that's the one I want work with presently. I tried adding a Cocoa Touch Unit Test Bundle target, but my build fails and I get command /bin/sh/ failed with exit code 1 and Failed tests for architecture 'i386' (GC OFF). I don't think I want to run on i386 (at least not for a test of my iOS target) and I can't find anything that says i386 in the target settings.
I see that my active architecture for the project is i386 (in the Project > Set Active Architecture menu), but it doesn't let me change it there. My TestApp target has Standard (armv6) as the architecture set and I tried searching the settings and nothing has i386 in it. How do I change that?
There's a template for a unit-test bundle target in the Mac OS X SDK.
Note that the “bundle” is the build product of the test target: The target produces a unit-test bundle. It does not require that your actual product (library, app, etc.) be a bundle; in fact, it doesn't matter what your actual product is.
That said, you can do it a little differently when you have a static library:
Normally, you would just add the source code files for your code under test to both the library target and the test bundle target, but doing things this way also tests your ability to link the test bundle against the library. If the library has any problems that would prevent linking against it, this may detect them.