Overview
Comment: | Merge trunk into branch "objfwtest" |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | objfwtest |
Files: | files | file ages | folders |
SHA3-256: |
96f556e1fd9a209d91d525721c8f2243 |
User & Date: | js on 2024-02-11 15:00:30 |
Other Links: | branch diff | manifest | tags |
Context
2024-02-11
| ||
15:12 | Migrate OFMethodSignatureTests to ObjFWTest check-in: de996cc580 user: js tags: objfwtest | |
15:00 | Merge trunk into branch "objfwtest" check-in: 96f556e1fd user: js tags: objfwtest | |
15:00 | ObjFWTest: Use nicer colors check-in: 5b3ba754b6 user: js tags: trunk | |
14:26 | Migrate OFCharacterSetTests to ObjFWTest check-in: 4127a58b04 user: js tags: objfwtest | |
Changes
Modified src/test/OTAppDelegate.m from [94d0e3c3f7] to [45c4eb9c1a].
︙ | ︙ | |||
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | } @finally { OFFreeMemory(methods); } [tests makeImmutable]; return tests; } - (void)applicationDidFinishLaunching: (OFNotification *)notification { OFSet OF_GENERIC(Class) *testClasses = [self testClasses]; size_t numSucceeded = 0, numFailed = 0; [OFStdOut writeFormat: @"Running %zu test case(s)\n", testClasses.count]; for (Class class in testClasses) { [OFStdOut writeFormat: @"Running tests in %@\n", class]; for (OFValue *test in [self testsInClass: class]) { void *pool = objc_autoreleasePoolPush(); bool failed = false; OTTestCase *instance; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | < < < | > > | < < < < < < | | > > > > < < < | | > > < < > > | | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | } @finally { OFFreeMemory(methods); } [tests makeImmutable]; return tests; } - (void)printStatusForTest: (SEL)test inClass: (Class)class status: (int)status description: (OFString *)description { switch (status) { case 0: [OFStdOut setForegroundColor: [OFColor olive]]; [OFStdOut writeFormat: @"-[%@ ", class]; [OFStdOut setForegroundColor: [OFColor yellow]]; [OFStdOut writeFormat: @"%s", sel_getName(test)]; [OFStdOut setForegroundColor: [OFColor olive]]; [OFStdOut writeString: @"]: "]; break; case 1: [OFStdOut setForegroundColor: [OFColor green]]; [OFStdOut writeFormat: @"\r-[%@ ", class]; [OFStdOut setForegroundColor: [OFColor lime]]; [OFStdOut writeFormat: @"%s", sel_getName(test)]; [OFStdOut setForegroundColor: [OFColor green]]; [OFStdOut writeLine: @"]: ok"]; break; case 2: [OFStdOut setForegroundColor: [OFColor maroon]]; [OFStdOut writeFormat: @"\r-[%@ ", class]; [OFStdOut setForegroundColor: [OFColor red]]; [OFStdOut writeFormat: @"%s", sel_getName(test)]; [OFStdOut setForegroundColor: [OFColor maroon]]; [OFStdOut writeLine: @"]: failed"]; [OFStdOut writeLine: description]; break; } [OFStdOut reset]; } - (void)applicationDidFinishLaunching: (OFNotification *)notification { OFSet OF_GENERIC(Class) *testClasses = [self testClasses]; size_t numSucceeded = 0, numFailed = 0; [OFStdOut writeFormat: @"Running %zu test case(s)\n", testClasses.count]; for (Class class in testClasses) { [OFStdOut setForegroundColor: [OFColor teal]]; [OFStdOut writeFormat: @"Running tests in %@\n", class]; [OFStdOut reset]; for (OFValue *test in [self testsInClass: class]) { void *pool = objc_autoreleasePoolPush(); bool failed = false; OTTestCase *instance; [self printStatusForTest: test.pointerValue inClass: class status: 0 description: nil]; instance = [[[class alloc] init] autorelease]; @try { [instance setUp]; [instance performSelector: test.pointerValue]; } @catch (OTAssertionFailedException *e) { /* * If an assertion fails during -[setUp], don't * run the test. * If an assertion fails during a test, abort * the test. */ [self printStatusForTest: test.pointerValue inClass: class status: 2 description: e.description]; failed = true; } @try { [instance tearDown]; } @catch (OTAssertionFailedException *e) { /* * If an assertion fails during -[tearDown], * abort the tear down. */ if (!failed) { SEL selector = test.pointerValue; OFString *description = e.description; [self printStatusForTest: selector inClass: class status: 2 description: description]; failed = true; } } if (!failed) { [self printStatusForTest: test.pointerValue inClass: class status: 1 description: nil]; numSucceeded++; } else numFailed++; objc_autoreleasePoolPop(pool); } } [OFStdOut setForegroundColor: [OFColor purple]]; [OFStdOut writeFormat: @"%zu test(s) succeeded, %zu test(s) failed.\n", numSucceeded, numFailed]; [OFStdOut reset]; [OFApplication terminateWithStatus: (int)numFailed]; } @end |