ObjFW  Check-in [d2b609cdd2]

Overview
Comment:ObjFWTest: Proper plurals in output
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | objfwtest
Files: files | file ages | folders
SHA3-256: d2b609cdd2213fc35e62a14ca612fe7cfd2f74fc80e1dfac82d6056b415a97d7
User & Date: js on 2024-02-13 02:16:03
Other Links: branch diff | manifest | tags
Context
2024-02-13
19:45
Remove some unneeded init methods from tests check-in: 7b5e4dedea user: js tags: objfwtest
02:16
ObjFWTest: Proper plurals in output check-in: d2b609cdd2 user: js tags: objfwtest
02:06
utils/objfw-new: Add --test to create tests check-in: 7f12b95f9c user: js tags: objfwtest
Changes

Modified src/test/OTAppDelegate.m from [6f0346b1a1] to [4119182bbc].

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
		[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;
	OFMutableDictionary *summaries = [OFMutableDictionary dictionary];






	[OFStdOut writeFormat: @"Running %zu test case(s)\n",
			       testClasses.count];

	for (Class class in testClasses) {
		OFArray *summary;

		[OFStdOut setForegroundColor: [OFColor teal]];
		[OFStdOut writeFormat: @"Running ", class];
		[OFStdOut setForegroundColor: [OFColor aqua]];
		[OFStdOut writeFormat: @"%@\n", class];
		[OFStdOut reset];

		for (OFValue *test in [self testsInClass: class]) {
			void *pool = objc_autoreleasePoolPush();
			bool failed = false;
			OTTestCase *instance;

			[self printStatusForTest: test.pointerValue







<
<








>
>
>
>
>
|
|








<







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
		[OFStdOut setForegroundColor: [OFColor red]];
		[OFStdOut writeFormat: @"%s", sel_getName(test)];
		[OFStdOut setForegroundColor: [OFColor maroon]];
		[OFStdOut writeLine: @"]: failed"];
		[OFStdOut writeLine: description];
		break;
	}


}

- (void)applicationDidFinishLaunching: (OFNotification *)notification
{
	OFSet OF_GENERIC(Class) *testClasses = [self testClasses];
	size_t numSucceeded = 0, numFailed = 0;
	OFMutableDictionary *summaries = [OFMutableDictionary dictionary];

	[OFStdOut setForegroundColor: [OFColor purple]];
	[OFStdOut writeString: @"Found "];
	[OFStdOut setForegroundColor: [OFColor fuchsia]];
	[OFStdOut writeFormat: @"%zu", testClasses.count];
	[OFStdOut setForegroundColor: [OFColor purple]];
	[OFStdOut writeFormat: @" test case%s\n",
			       (testClasses.count != 1 ? "s" : "")];

	for (Class class in testClasses) {
		OFArray *summary;

		[OFStdOut setForegroundColor: [OFColor teal]];
		[OFStdOut writeFormat: @"Running ", class];
		[OFStdOut setForegroundColor: [OFColor aqua]];
		[OFStdOut writeFormat: @"%@\n", class];


		for (OFValue *test in [self testsInClass: class]) {
			void *pool = objc_autoreleasePoolPush();
			bool failed = false;
			OTTestCase *instance;

			[self printStatusForTest: test.pointerValue
260
261
262
263
264
265
266
267

268
269
270
271

272
273
274
275
276
			[OFStdOut writeFormat: @"%@\n", line.secondObject];
		}
	}

	[OFStdOut setForegroundColor: [OFColor fuchsia]];
	[OFStdOut writeFormat: @"%zu", numSucceeded];
	[OFStdOut setForegroundColor: [OFColor purple]];
	[OFStdOut writeString: @" test(s) succeeded, "];

	[OFStdOut setForegroundColor: [OFColor fuchsia]];
	[OFStdOut writeFormat: @"%zu", numFailed];
	[OFStdOut setForegroundColor: [OFColor purple]];
	[OFStdOut writeLine: @" test(s) failed."];

	[OFStdOut reset];

	[OFApplication terminateWithStatus: (int)numFailed];
}
@end







|
>



|
>





262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
			[OFStdOut writeFormat: @"%@\n", line.secondObject];
		}
	}

	[OFStdOut setForegroundColor: [OFColor fuchsia]];
	[OFStdOut writeFormat: @"%zu", numSucceeded];
	[OFStdOut setForegroundColor: [OFColor purple]];
	[OFStdOut writeFormat: @" test%s succeeded, ",
			       (numSucceeded != 1 ? "s" : "")];
	[OFStdOut setForegroundColor: [OFColor fuchsia]];
	[OFStdOut writeFormat: @"%zu", numFailed];
	[OFStdOut setForegroundColor: [OFColor purple]];
	[OFStdOut writeFormat: @" test%s failed\n",
			       (numFailed != 1 ? "s" : "")];
	[OFStdOut reset];

	[OFApplication terminateWithStatus: (int)numFailed];
}
@end