OSX compatibility tweaks based on running testcases on 10.13.2 (high sierra).

This commit is contained in:
Richard Frith-Macdonald 2018-01-03 15:42:09 +00:00
parent 6150b3fd62
commit dae9b8973e
2 changed files with 77 additions and 72 deletions

View file

@ -52,7 +52,6 @@ int main()
num = [url propertyForKey: NSHTTPPropertyStatusCodeKey];
PASS([num isKindOfClass: [NSNumber class]] && [num intValue] == 404,
"Status of load is 404 for www.w3.org/silly-file-name");
str = [url scheme];
PASS([str isEqual: @"http"],
"Scheme of http://www.w3.org/silly-file-name is http");
@ -67,16 +66,23 @@ int main()
url = [NSURL URLWithString: @"http://www.w3.org/silly-file-path/"];
str = [url path];
PASS([str isEqual: @"/silly-file-path"],
PASS_EQUAL([url path], @"/silly-file-path",
"Path of http://www.w3.org/silly-file-path/ is /silly-file-path");
PASS([[url resourceSpecifier] isEqual: @"//www.w3.org/silly-file-path/"],
PASS_EQUAL([url resourceSpecifier], @"//www.w3.org/silly-file-path/",
"resourceSpecifier of http://www.w3.org/silly-file-path/ is //www.w3.org/silly-file-path/");
str = [url absoluteString];
PASS([str isEqual: @"http://www.w3.org/silly-file-path/"],
PASS_EQUAL([url absoluteString], @"http://www.w3.org/silly-file-path/",
"Abs of http://www.w3.org/silly-file-path/ is correct");
url = [NSURL URLWithString: @"http://www.w3.org"];
PASS_EQUAL([url scheme], @"http",
"Scheme of http://www.w3.org is http");
PASS_EQUAL([url host], @"www.w3.org",
"Host of http://www.w3.org is www.w3.org");
PASS_EQUAL([url path], @"",
"Path of http://www.w3.org is empty");
PASS_EQUAL([url resourceSpecifier], @"//www.w3.org",
"resourceSpecifier of http://www.w3.org is //www.w3.org");
#if defined(_WIN32)
url = [NSURL fileURLWithPath: @"C:\\WINDOWS"];
str = [url path];
@ -90,10 +96,10 @@ int main()
url = [NSURL fileURLWithPath: @"/usr"];
str = [url path];
PASS_EQUAL(str, @"/usr", "Path of file URL /usr is /usr");
PASS_EQUAL([url description], @"file://localhost/usr/",
"File URL /usr is file://localhost/usr/");
PASS_EQUAL([url resourceSpecifier], @"//localhost/usr/",
"resourceSpecifier of /usr is //localhost/usr/");
PASS_EQUAL([url description], @"file:///usr/",
"File URL /usr is file:///usr/");
PASS_EQUAL([url resourceSpecifier], @"/usr/",
"resourceSpecifier of /usr is /usr/");
#endif
PASS_EXCEPTION([[NSURL alloc] initFileURLWithPath: nil isDirectory: YES],
@ -252,7 +258,7 @@ GSPathHandling("unix");
url = [NSURL fileURLWithPath: str];
NSLog(@"path quoting %@", [url absoluteString]);
PASS_EQUAL([url absoluteString],
@"file://localhost/%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20!%22%23$%25&'()*+,-./0123456789:%3B%3C=%3E%3F@ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F%C2%80%C2%81%C2%82%C2%83%C2%84%C2%85%C2%86%C2%87%C2%88%C2%89%C2%8A%C2%8B%C2%8C%C2%8D%C2%8E%C2%8F%C2%90%C2%91%C2%92%C2%93%C2%94%C2%95%C2%96%C2%97%C2%98%C2%99%C2%9A%C2%9B%C2%9C%C2%9D%C2%9E%C2%9F%C2%A0%C2%A1%C2%A2%C2%A3%C2%A4%C2%A5%C2%A6%C2%A7%C2%A8%C2%A9%C2%AA%C2%AB%C2%AC%C2%AD%C2%AE%C2%AF%C2%B0%C2%B1%C2%B2%C2%B3%C2%B4%C2%B5%C2%B6%C2%B7%C2%B8%C2%B9%C2%BA%C2%BB%C2%BC%C2%BD%C2%BE%C2%BF%C3%80%C3%81%C3%82%C3%83%C3%84%C3%85%C3%86%C3%87%C3%88%C3%89%C3%8A%C3%8B%C3%8C%C3%8D%C3%8E%C3%8F%C3%90%C3%91%C3%92%C3%93%C3%94%C3%95%C3%96%C3%97%C3%98%C3%99%C3%9A%C3%9B%C3%9C%C3%9D%C3%9E%C3%9F%C3%A0%C3%A1%C3%A2%C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B3%C3%B4%C3%B5%C3%B6%C3%B7%C3%B8%C3%B9%C3%BA%C3%BB%C3%BC%C3%BD%C3%BE%C3%BF", "path quoting");
/* Test +fileURLWithPath: for messy/complex path
*/
@ -262,9 +268,9 @@ GSPathHandling("unix");
PASS_EQUAL([url fragment], nil, "complex -fragment");
PASS_EQUAL([url parameterString], nil, "complex -parameterString");
PASS_EQUAL([url query], nil, "complex -query");
PASS_EQUAL([url absoluteString], @"file://localhost/this%23is%20a%20Path%20with%20%25%20+%20=%20&%20%3C%20%3E%20%3F", "complex -absoluteString");
PASS_EQUAL([url relativeString], @"file://localhost/this%23is%20a%20Path%20with%20%25%20+%20=%20&%20%3C%20%3E%20%3F", "complex -relativeString");
PASS_EQUAL([url description], @"file://localhost/this%23is%20a%20Path%20with%20%25%20+%20=%20&%20%3C%20%3E%20%3F", "complex -description");
PASS_EQUAL([url absoluteString], @"file:///this%23is%20a%20Path%20with%20%25%20+%20=%20&%20%3C%20%3E%20%3F", "complex -absoluteString");
PASS_EQUAL([url relativeString], @"file:///this%23is%20a%20Path%20with%20%25%20+%20=%20&%20%3C%20%3E%20%3F", "complex -relativeString");
PASS_EQUAL([url description], @"file:///this%23is%20a%20Path%20with%20%25%20+%20=%20&%20%3C%20%3E%20%3F", "complex -description");
#if defined(_WIN32)
GSPathHandling("right");