Just a quick note on how I build my test tools (they run separately, either by manual invocation or via CI) when I’m working in GNUstep.
Firstly, you’ll need Catch. Then given test files that look like this:
test_class.mm #define CATCH_CONFIG_MAIN #include "catch.hpp" #importTEST_CASE("Using foundation", "I should be able to use Foundation classes from a test tool") { NSArray *array = [NSArray array]; REQUIRE([array count] == 0); }
(only one of your files should define CATCH_CONFIG_MAIN as you must only have one main function).
Then I define a tests target in my Makefile:
GNUmakefile include $(GNUSTEP_MAKEFILES)/common.make #… stuff to define my app target TEST_TOOL_NAME=tests tests_OBJCC_FILES = test_class.mm other_tests.mm blah.mm tests_OBJCCFLAGS="-ICatch/include" -include Makefile.preamble #… include target definitions for the app target include $(GNUSTEP_MAKEFILES)/test-tool.make -include Makefile.postamble
And there it is. Now whenever I make my app I also get obj/tests which’ll run the test suite for me.