ObjFW  Check-in [523f721292]

Overview
Comment:Skip (sym)link tests if unavailable
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 523f7212921f0fac3f63082abe59a3d528ad27b8225f1ec9ef96c1cc4772cdb2
User & Date: js on 2024-04-28 12:47:07
Other Links: manifest | tags
Context
2024-04-29
03:31
OFEmbeddedIRIHandler: Fix missing static check-in: cce464b94e user: js tags: trunk
2024-04-28
18:15
Merge trunk into branch "sctp" check-in: bd2d723910 user: js tags: sctp
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: cd829b4336 user: js tags: trunk
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");
}