ObjFW  Check-in [ef5b11edae]

Overview
Comment:tests: Use simple output if we have no terminal

This temporarily makes various game consoles use the simple output,
until the terminal control methods for these are implemented.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: ef5b11edaec40f904590bb48c2ea4689caa786137b3c624e707214f8fc5d2c7b
User & Date: js on 2020-05-28 00:34:07
Other Links: manifest | tags
Context
2020-05-28
21:14
Work around new libctru using id as parameter name (check-in: f4ba103dc0 user: js tags: trunk)
00:34
tests: Use simple output if we have no terminal (check-in: ef5b11edae user: js tags: trunk)
00:15
OFStdIOStream: Add -[hasTerminal] (check-in: d5eb0384c5 user: js tags: trunk)
Changes

Modified tests/TestsAppDelegate.m from [6175cf9d40] to [9e16d3935e].

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
225
226
227
228

229
230
231
232
233
234
235
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
225

226
227
228
229
230
231
232
233







-
+


-
+

-





-
+




-
+

-





-
+







#endif
}

@implementation TestsAppDelegate
- (void)outputTesting: (OFString *)test
	     inModule: (OFString *)module
{
#ifndef STDOUT_SIMPLE
	if (of_stdout.hasTerminal) {
	of_stdout.foregroundColor = [OFColor yellow];
	[of_stdout writeFormat: @"[%@] %@: testing...", module, test];
#else
	} else
	[of_stdout writeFormat: @"[%@] %@: ", module, test];
#endif
}

- (void)outputSuccess: (OFString *)test
	     inModule: (OFString *)module
{
#ifndef STDOUT_SIMPLE
	if (of_stdout.hasTerminal) {
	of_stdout.cursorColumn = 0;
	of_stdout.foregroundColor = [OFColor lime];
	[of_stdout eraseLine];
	[of_stdout writeFormat: @"[%@] %@: ok\n", module, test];
#else
	} else
	[of_stdout writeLine: @"ok"];
#endif
}

- (void)outputFailure: (OFString *)test
	     inModule: (OFString *)module
{
#ifndef STDOUT_SIMPLE
	if (of_stdout.hasTerminal) {
	of_stdout.cursorColumn = 0;
	of_stdout.foregroundColor = [OFColor red];
	[of_stdout eraseLine];
	[of_stdout writeFormat: @"[%@] %@: failed\n", module, test];

# ifdef OF_WII
	[of_stdout reset];
285
286
287
288
289
290
291
292

293
294
295
296
297
298
299
300
301
283
284
285
286
287
288
289

290
291

292
293
294
295
296
297
298







-
+

-







		gspWaitForVBlank();
	}
# endif

	of_stdout.cursorColumn = 0;
	[of_stdout reset];
	[of_stdout eraseLine];
#else
	} else
	[of_stdout writeLine: @"failed"];
#endif
}

- (void)applicationDidFinishLaunching
{
#if defined(OF_IOS) && defined(OF_HAVE_FILES)
	CFBundleRef mainBundle = CFBundleGetMainBundle();
	CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);