ObjFW  Check-in [23b9666b71]

Overview
Comment:OFFileManagerTests: Add tests for xattr
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 23b9666b71522c423a884e67c85ff6dd3861aa378c3593b1b129ceb40bd7fd90
User & Date: js on 2024-03-17 09:41:43
Other Links: manifest | tags
References
2024-03-17
09:45 Fixed ticket [3e6dc8e381]: Tests for OFFileIRIHandler plus 4 other changes artifact: d470775856 user: js
Context
2024-03-17
11:55
ofarc: Propagate quarantine xattr when extracting check-in: 7683a12e79 user: js tags: trunk
09:41
OFFileManagerTests: Add tests for xattr check-in: 23b9666b71 user: js tags: trunk
09:41
OFFileManager: Fix getting non-existent xattr check-in: 0fe644ef2c user: js tags: trunk
Changes

Modified tests/OFFileManagerTests.m from [51b8d13873] to [e21aaa5d46].

342
343
344
345
346
347
348





































349

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





































@end







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386

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

#ifdef OF_FILE_MANAGER_SUPPORTS_EXTENDED_ATTRIBUTES
- (void)testExtendedAttributes
{
	OFData *data = [OFData dataWithItems: "test" count: 4];
	OFString *testFilePath = _testFileIRI.fileSystemRepresentation;
	OFFileAttributes attributes;
	OFArray *extendedAttributeNames;

	[_fileManager setExtendedAttributeData: data
				       forName: @"user.test"
				  ofItemAtPath: testFilePath];

	attributes = [_fileManager attributesOfItemAtIRI: _testFileIRI];
	extendedAttributeNames =
	    [attributes objectForKey: OFFileExtendedAttributesNames];
	OTAssertNotNil(extendedAttributeNames);
	OTAssertTrue([extendedAttributeNames containsObject: @"user.test"]);
	OTAssertEqualObjects(
	    [_fileManager extendedAttributeDataForName: @"user.test"
					  ofItemAtPath: testFilePath],
	    data);

	[_fileManager removeExtendedAttributeForName: @"user.test"
					ofItemAtPath: testFilePath];

	attributes = [_fileManager attributesOfItemAtIRI: _testFileIRI];
	extendedAttributeNames =
	    [attributes objectForKey: OFFileExtendedAttributesNames];
	OTAssertNotNil(extendedAttributeNames);
	OTAssertFalse([extendedAttributeNames containsObject: @"user.test"]);
	OTAssertThrowsSpecific(
	    [_fileManager extendedAttributeDataForName: @"user.test"
					  ofItemAtPath: testFilePath],
	    OFGetItemAttributesFailedException);
}
#endif
@end