ObjFW  Check-in [2ea81cb7c3]

Overview
Comment:Skip (sym)link tests if unavailable
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | 1.1
Files: files | file ages | folders
SHA3-256: 2ea81cb7c3f00587c8ee10a3fd633fde2dce2c700725579708be5db47cf00127
User & Date: js on 2024-04-28 12:47:19
Other Links: branch diff | manifest | tags
Context
2024-04-29
03:31
OFEmbeddedIRIHandler: Fix missing static check-in: 5fb890f145 user: js tags: 1.1
2024-04-28
12:47
Skip (sym)link tests if unavailable check-in: 2ea81cb7c3 user: js tags: 1.1
12:47
Skip (sym)link tests if unavailable check-in: 523f721292 user: js tags: trunk
11:56
Workaround for OFSubprocessTests on Windows 9x check-in: 7937aed40b user: js tags: 1.1
Changes

Modified tests/OFFileManagerTests.m from [ff06e4c90e] to [08e4ea3058].

304
305
306
307
308
309
310


311
312



313
314
315
316
317
318
319
	    IRIByAppendingPathComponent: @"source"];
	OFIRI *destinationIRI = [_testsDirectoryIRI
	    IRIByAppendingPathComponent: @"destination"];
	OFFileAttributes attributes;

	[@"test" writeToIRI: sourceIRI];



	[_fileManager linkItemAtPath: sourceIRI.fileSystemRepresentation
			      toPath: destinationIRI.fileSystemRepresentation];




	attributes = [_fileManager attributesOfItemAtIRI: destinationIRI];
	OTAssertEqual(attributes.fileType, OFFileTypeRegular);
	OTAssertEqual(attributes.fileSize, 4);
	OTAssertEqualObjects([OFString stringWithContentsOfIRI: destinationIRI],
	    @"test");
}







>
>
|
|
>
>
>







304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
	    IRIByAppendingPathComponent: @"source"];
	OFIRI *destinationIRI = [_testsDirectoryIRI
	    IRIByAppendingPathComponent: @"destination"];
	OFFileAttributes attributes;

	[@"test" writeToIRI: sourceIRI];

	@try {
		[_fileManager
		    linkItemAtPath: sourceIRI.fileSystemRepresentation
			    toPath: destinationIRI.fileSystemRepresentation];
	} @catch (OFNotImplementedException *e) {
		OTSkip(@"Links not supported");
	}

	attributes = [_fileManager attributesOfItemAtIRI: destinationIRI];
	OTAssertEqual(attributes.fileType, OFFileTypeRegular);
	OTAssertEqual(attributes.fileSize, 4);
	OTAssertEqualObjects([OFString stringWithContentsOfIRI: destinationIRI],
	    @"test");
}
346
347
348
349
350
351
352


353
354
355
356
357
358
359
	} @catch (OFCreateSymbolicLinkFailedException *e) {
		if (e.errNo != EPERM)
			@throw e;

		OTSkip(@"No permission to create symlink.\n"
		    @"On Windows, only the administrator can create symbolic "
		    @"links.");


	}

	attributes = [_fileManager attributesOfItemAtIRI: destinationIRI];
	OTAssertEqual(attributes.fileType, OFFileTypeSymbolicLink);
	OTAssertEqualObjects([OFString stringWithContentsOfIRI: destinationIRI],
	    @"test");
}







>
>







351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
	} @catch (OFCreateSymbolicLinkFailedException *e) {
		if (e.errNo != EPERM)
			@throw e;

		OTSkip(@"No permission to create symlink.\n"
		    @"On Windows, only the administrator can create symbolic "
		    @"links.");
	} @catch (OFNotImplementedException *e) {
		OTSkip(@"Symlinks not supported");
	}

	attributes = [_fileManager attributesOfItemAtIRI: destinationIRI];
	OTAssertEqual(attributes.fileType, OFFileTypeSymbolicLink);
	OTAssertEqualObjects([OFString stringWithContentsOfIRI: destinationIRI],
	    @"test");
}