Index: src/test/OTAppDelegate.m ================================================================== --- src/test/OTAppDelegate.m +++ src/test/OTAppDelegate.m @@ -145,11 +145,11 @@ padConfigureInput(1, HidNpadStyleSet_NpadStandard); updateConsole(true); #endif } -- (OFSet OF_GENERIC(Class) *)testClasses +- (OFMutableSet OF_GENERIC(Class) *)testClasses { Class *classes = objc_copyClassList(NULL); OFMutableSet *testClasses; if (classes == NULL) @@ -180,11 +180,10 @@ OFFreeMemory(classes); } [testClasses removeObject: [OTTestCase class]]; - [testClasses makeImmutable]; return testClasses; } - (OFSet OF_GENERIC(OFValue *) *)testsInClass: (Class)class { @@ -400,16 +399,36 @@ return description; } - (void)applicationDidFinishLaunching: (OFNotification *)notification { - OFSet OF_GENERIC(Class) *testClasses = [self testClasses]; + OFMutableSet OF_GENERIC(Class) *testClasses; size_t numSucceeded = 0, numFailed = 0, numSkipped = 0; OFMutableDictionary *summaries = [OFMutableDictionary dictionary]; + + if ([OFApplication arguments].count > 0) { + testClasses = [OFMutableSet set]; + + for (OFString *className in [OFApplication arguments]) { + Class class = objc_lookUpClass([className + cStringWithEncoding: OFStringEncodingASCII]); + + if (class == Nil || + !isSubclassOfClass(class, [OTTestCase class])) { + [OFStdErr writeFormat: @"%@ is not a valid " + @"test case!\n", + className]; + [OFApplication terminateWithStatus: 1]; + } + + [testClasses addObject: class]; + } + } else + testClasses = [self testClasses]; [OFStdOut setForegroundColor: [OFColor purple]]; - [OFStdOut writeString: @"Found "]; + [OFStdOut writeString: @"Running "]; #if !defined(OF_WII) && !defined(OF_NINTENDO_DS) && \ !defined(OF_NINTENDO_3DS) && !defined(OF_NINTENDO_SWITCH) [OFStdOut setForegroundColor: [OFColor fuchsia]]; #endif [OFStdOut writeFormat: @"%zu", testClasses.count]; Index: tests/Makefile ================================================================== --- tests/Makefile +++ tests/Makefile @@ -145,11 +145,11 @@ LD_LIBRARY_PATH=.$${LD_LIBRARY_PATH+:}$$LD_LIBRARY_PATH \ DYLD_FRAMEWORK_PATH=../src:../src/runtime$${DYLD_FRAMEWORK_PATH+:}$$DYLD_FRAMEWORK_PATH \ DYLD_LIBRARY_PATH=.$${DYLD_LIBRARY_PATH+:}$$DYLD_LIBRARY_PATH \ LIBRARY_PATH=.$${LIBRARY_PATH+:}$$LIBRARY_PATH \ ASAN_OPTIONS=allocator_may_return_null=1 \ - ${WRAPPER} ./${PROG_NOINST}; EXIT=$$?; \ + ${WRAPPER} ./${PROG_NOINST} ${TESTCASES}; EXIT=$$?; \ rm -f libobjfw.so.${OBJFW_LIB_MAJOR}; \ rm -f libobjfw.so.${OBJFW_LIB_MAJOR_MINOR}; \ rm -f objfw${OBJFW_LIB_MAJOR}.dll; \ rm -f libobjfw.${OBJFW_LIB_MAJOR}.dylib; \ rm -f libobjfwrt.so.${OBJFWRT_LIB_MAJOR}; \