mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-29 16:01:38 +00:00
Add test for -[NSFileManager contentsOfDirectoryAtURL:...]
This commit is contained in:
parent
a2f63bfec0
commit
df743e6d52
1 changed files with 25 additions and 0 deletions
|
@ -142,6 +142,31 @@ int main()
|
|||
"-contentsOfDirectoryAtPath: agrees");
|
||||
}
|
||||
|
||||
{
|
||||
NSArray *a;
|
||||
NSString *dir1 = [mgr currentDirectoryPath];
|
||||
|
||||
[mgr changeCurrentDirectoryPath: [dir1 stringByDeletingLastPathComponent]];
|
||||
a = [mgr contentsOfDirectoryAtPath: dir error: 0];
|
||||
PASS(1 == [a count] && [[a lastObject] isEqual: @"NSFMFile"],
|
||||
"-contentsOfDirectoryAtPath: agrees with different current directory");
|
||||
[mgr changeCurrentDirectoryPath: dir1];
|
||||
}
|
||||
|
||||
{
|
||||
NSArray *a;
|
||||
NSString *dir1 = [mgr currentDirectoryPath];
|
||||
NSURL *dirURL = [NSURL fileURLWithPath: dir1];
|
||||
NSURL *fileURL = [dirURL URLByAppendingPathComponent: @"NSFMFile"];
|
||||
|
||||
[mgr changeCurrentDirectoryPath: [dir1 stringByDeletingLastPathComponent]];
|
||||
a = [mgr contentsOfDirectoryAtURL: dirURL includingPropertiesForKeys: nil
|
||||
options: 0 error: NULL];
|
||||
PASS(1 == [a count] && [[a lastObject] isEqual: fileURL],
|
||||
"-contentsOfDirectoryAtURL: agrees with different current directory");
|
||||
[mgr changeCurrentDirectoryPath: dir];
|
||||
}
|
||||
|
||||
{
|
||||
NSData *dat1 = [mgr contentsAtPath: @"NSFMFile"];
|
||||
str2 = [[NSString alloc] initWithData: dat1 encoding: 1];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue