102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
#ifdef OF_HAVE_FILES
TEST(@"+[fileURLWithPath:]",
[[[OFURL fileURLWithPath: @"testfile.txt"] fileSystemRepresentation]
isEqual: [[OFFileManager defaultManager].currentDirectoryPath
stringByAppendingPathComponent: @"testfile.txt"]])
# ifdef OF_WINDOWS
OFURL *tmp;
TEST(@"+[fileURLWithPath:] with UNC",
(tmp = [OFURL fileURLWithPath: @"\\\\foo\\bar"]) &&
[tmp.host isEqual: @"foo"] && [tmp.path isEqual: @"/bar"] &&
[tmp.string isEqual: @"file://foo/bar"] &&
[tmp.fileSystemRepresentation isEqual: @"\\\\foo\\bar"] &&
(tmp = [OFURL fileURLWithPath: @"\\\\test"]) &&
[tmp.host isEqual: @"test"] && [tmp.path isEqual: @"/"] &&
|
|
>
>
>
>
>
>
>
|
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
#ifdef OF_HAVE_FILES
TEST(@"+[fileURLWithPath:]",
[[[OFURL fileURLWithPath: @"testfile.txt"] fileSystemRepresentation]
isEqual: [[OFFileManager defaultManager].currentDirectoryPath
stringByAppendingPathComponent: @"testfile.txt"]])
# if defined(OF_WINDOWS) || defined(OF_MSDOS)
OFURL *tmp;
TEST(@"+[fileURLWithPath:] for c:\\",
(tmp = [OFURL fileURLWithPath: @"c:\\"]) &&
[tmp.string isEqual: @"file:///c:/"] &&
[tmp.fileSystemRepresentation isEqual: @"c:\\"])
# endif
# ifdef OF_WINDOWS
TEST(@"+[fileURLWithPath:] with UNC",
(tmp = [OFURL fileURLWithPath: @"\\\\foo\\bar"]) &&
[tmp.host isEqual: @"foo"] && [tmp.path isEqual: @"/bar"] &&
[tmp.string isEqual: @"file://foo/bar"] &&
[tmp.fileSystemRepresentation isEqual: @"\\\\foo\\bar"] &&
(tmp = [OFURL fileURLWithPath: @"\\\\test"]) &&
[tmp.host isEqual: @"test"] && [tmp.path isEqual: @"/"] &&
|