@@ -15,317 +15,327 @@ #include "config.h" #import "TestsAppDelegate.h" -static OFString *const module = @"OFURL"; -static OFString *URLString = @"ht%3atp://us%3Aer:p%40w@ho%3Ast:1234/" +static OFString *const module = @"OFURI"; +static OFString *URIString = @"ht%3atp://us%3Aer:p%40w@ho%3Ast:1234/" @"pa%3Fth?que%23ry=1&f%26oo=b%3dar#frag%23ment"; -@implementation TestsAppDelegate (OFURLTests) -- (void)URLTests +@implementation TestsAppDelegate (OFURITests) +- (void)URITests { void *pool = objc_autoreleasePoolPush(); - OFURL *URL1, *URL2, *URL3, *URL4, *URL5, *URL6, *URL7; - OFMutableURL *mutableURL; - - TEST(@"+[URLWithString:]", - R(URL1 = [OFURL URLWithString: URLString]) && - R(URL2 = [OFURL URLWithString: @"http://foo:80"]) && - R(URL3 = [OFURL URLWithString: @"http://bar/"]) && - R(URL4 = [OFURL URLWithString: @"file:///etc/passwd"]) && - R(URL5 = [OFURL URLWithString: @"http://foo/bar/qux/foo%2fbar"]) && - R(URL6 = [OFURL URLWithString: @"https://[12:34::56:abcd]/"]) && - R(URL7 = [OFURL URLWithString: @"https://[12:34::56:abcd]:234/"])) - - EXPECT_EXCEPTION(@"+[URLWithString:] fails with invalid characters #1", - OFInvalidFormatException, - [OFURL URLWithString: @"ht,tp://foo"]) - - EXPECT_EXCEPTION(@"+[URLWithString:] fails with invalid characters #2", - OFInvalidFormatException, - [OFURL URLWithString: @"http://f`oo"]) - - EXPECT_EXCEPTION(@"+[URLWithString:] fails with invalid characters #3", - OFInvalidFormatException, - [OFURL URLWithString: @"http://foo/`"]) - - EXPECT_EXCEPTION(@"+[URLWithString:] fails with invalid characters #4", - OFInvalidFormatException, - [OFURL URLWithString: @"http://foo/foo?`"]) - - EXPECT_EXCEPTION(@"+[URLWithString:] fails with invalid characters #5", - OFInvalidFormatException, - [OFURL URLWithString: @"http://foo/foo?foo#`"]) - - EXPECT_EXCEPTION(@"+[URLWithString:] fails with invalid characters #6", - OFInvalidFormatException, - [OFURL URLWithString: @"https://[g]/"]) - - EXPECT_EXCEPTION(@"+[URLWithString:] fails with invalid characters #7", - OFInvalidFormatException, - [OFURL URLWithString: @"https://[f]:/"]) - - EXPECT_EXCEPTION(@"+[URLWithString:] fails with invalid characters #8", - OFInvalidFormatException, - [OFURL URLWithString: @"https://[f]:f/"]) - - TEST(@"+[URLWithString:relativeToURL:]", - [[[OFURL URLWithString: @"/foo" relativeToURL: URL1] string] + OFURI *URI1, *URI2, *URI3, *URI4, *URI5, *URI6, *URI7; + OFMutableURI *mutableURI; + + TEST(@"+[URIWithString:]", + R(URI1 = [OFURI URIWithString: URIString]) && + R(URI2 = [OFURI URIWithString: @"http://foo:80"]) && + R(URI3 = [OFURI URIWithString: @"http://bar/"]) && + R(URI4 = [OFURI URIWithString: @"file:///etc/passwd"]) && + R(URI5 = [OFURI URIWithString: @"http://foo/bar/qux/foo%2fbar"]) && + R(URI6 = [OFURI URIWithString: @"https://[12:34::56:abcd]/"]) && + R(URI7 = [OFURI URIWithString: @"https://[12:34::56:abcd]:234/"])) + + EXPECT_EXCEPTION(@"+[URIWithString:] fails with invalid characters #1", + OFInvalidFormatException, + [OFURI URIWithString: @"ht,tp://foo"]) + + EXPECT_EXCEPTION(@"+[URIWithString:] fails with invalid characters #2", + OFInvalidFormatException, + [OFURI URIWithString: @"http://f`oo"]) + + EXPECT_EXCEPTION(@"+[URIWithString:] fails with invalid characters #3", + OFInvalidFormatException, + [OFURI URIWithString: @"http://foo/`"]) + + EXPECT_EXCEPTION(@"+[URIWithString:] fails with invalid characters #4", + OFInvalidFormatException, + [OFURI URIWithString: @"http://foo/foo?`"]) + + EXPECT_EXCEPTION(@"+[URIWithString:] fails with invalid characters #5", + OFInvalidFormatException, + [OFURI URIWithString: @"http://foo/foo?foo#`"]) + + EXPECT_EXCEPTION(@"+[URIWithString:] fails with invalid characters #6", + OFInvalidFormatException, + [OFURI URIWithString: @"https://[g]/"]) + + EXPECT_EXCEPTION(@"+[URIWithString:] fails with invalid characters #7", + OFInvalidFormatException, + [OFURI URIWithString: @"https://[f]:/"]) + + EXPECT_EXCEPTION(@"+[URIWithString:] fails with invalid characters #8", + OFInvalidFormatException, + [OFURI URIWithString: @"https://[f]:f/"]) + + TEST(@"+[URIWithString:relativeToURI:]", + [[[OFURI URIWithString: @"/foo" relativeToURI: URI1] string] isEqual: @"ht%3atp://us%3Aer:p%40w@ho%3Ast:1234/foo"] && - [[[OFURL URLWithString: @"foo/bar?q" - relativeToURL: [OFURL URLWithString: @"http://h/qux/quux"]] + [[[OFURI URIWithString: @"foo/bar?q" + relativeToURI: [OFURI URIWithString: @"http://h/qux/quux"]] string] isEqual: @"http://h/qux/foo/bar?q"] && - [[[OFURL URLWithString: @"foo/bar" - relativeToURL: [OFURL URLWithString: @"http://h/qux/?x"]] + [[[OFURI URIWithString: @"foo/bar" + relativeToURI: [OFURI URIWithString: @"http://h/qux/?x"]] string] isEqual: @"http://h/qux/foo/bar"] && - [[[OFURL URLWithString: @"http://foo/?q" - relativeToURL: URL1] string] isEqual: @"http://foo/?q"] && - [[[OFURL URLWithString: @"foo" - relativeToURL: [OFURL URLWithString: @"http://foo/bar"]] + [[[OFURI URIWithString: @"http://foo/?q" + relativeToURI: URI1] string] isEqual: @"http://foo/?q"] && + [[[OFURI URIWithString: @"foo" + relativeToURI: [OFURI URIWithString: @"http://foo/bar"]] string] isEqual: @"http://foo/foo"] && - [[[OFURL URLWithString: @"foo" - relativeToURL: [OFURL URLWithString: @"http://foo"]] + [[[OFURI URIWithString: @"foo" + relativeToURI: [OFURI URIWithString: @"http://foo"]] string] isEqual: @"http://foo/foo"]) EXPECT_EXCEPTION( - @"+[URLWithString:relativeToURL:] fails with invalid characters #1", - OFInvalidFormatException, - [OFURL URLWithString: @"`" relativeToURL: URL1]) - - EXPECT_EXCEPTION( - @"+[URLWithString:relativeToURL:] fails with invalid characters #2", - OFInvalidFormatException, - [OFURL URLWithString: @"/`" relativeToURL: URL1]) - - EXPECT_EXCEPTION( - @"+[URLWithString:relativeToURL:] fails with invalid characters #3", - OFInvalidFormatException, - [OFURL URLWithString: @"?`" relativeToURL: URL1]) - - EXPECT_EXCEPTION( - @"+[URLWithString:relativeToURL:] fails with invalid characters #4", - OFInvalidFormatException, - [OFURL URLWithString: @"#`" relativeToURL: URL1]) + @"+[URIWithString:relativeToURI:] fails with invalid characters #1", + OFInvalidFormatException, + [OFURI URIWithString: @"`" relativeToURI: URI1]) + + EXPECT_EXCEPTION( + @"+[URIWithString:relativeToURI:] fails with invalid characters #2", + OFInvalidFormatException, + [OFURI URIWithString: @"/`" relativeToURI: URI1]) + + EXPECT_EXCEPTION( + @"+[URIWithString:relativeToURI:] fails with invalid characters #3", + OFInvalidFormatException, + [OFURI URIWithString: @"?`" relativeToURI: URI1]) + + EXPECT_EXCEPTION( + @"+[URIWithString:relativeToURI:] fails with invalid characters #4", + OFInvalidFormatException, + [OFURI URIWithString: @"#`" relativeToURI: URI1]) #ifdef OF_HAVE_FILES - TEST(@"+[fileURLWithPath:]", - [[[OFURL fileURLWithPath: @"testfile.txt"] fileSystemRepresentation] + TEST(@"+[fileURIWithPath:]", + [[[OFURI fileURIWithPath: @"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:\\"]) && + OFURI *tmp; + TEST(@"+[fileURIWithPath:] for c:\\", + (tmp = [OFURI fileURIWithPath: @"c:\\"]) && [tmp.string isEqual: @"file:///c:/"] && [tmp.fileSystemRepresentation isEqual: @"c:\\"]) # endif # ifdef OF_WINDOWS - TEST(@"+[fileURLWithPath:] with UNC", - (tmp = [OFURL fileURLWithPath: @"\\\\foo\\bar"]) && + TEST(@"+[fileURIWithPath:] with UNC", + (tmp = [OFURI fileURIWithPath: @"\\\\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 = [OFURI fileURIWithPath: @"\\\\test"]) && [tmp.host isEqual: @"test"] && [tmp.path isEqual: @"/"] && [tmp.string isEqual: @"file://test/"] && [tmp.fileSystemRepresentation isEqual: @"\\\\test"]) # endif #endif TEST(@"-[string]", - [URL1.string isEqual: URLString] && - [URL2.string isEqual: @"http://foo:80"] && - [URL3.string isEqual: @"http://bar/"] && - [URL4.string isEqual: @"file:///etc/passwd"]) + [URI1.string isEqual: URIString] && + [URI2.string isEqual: @"http://foo:80"] && + [URI3.string isEqual: @"http://bar/"] && + [URI4.string isEqual: @"file:///etc/passwd"]) TEST(@"-[scheme]", - [URL1.scheme isEqual: @"ht:tp"] && [URL4.scheme isEqual: @"file"]) + [URI1.scheme isEqual: @"ht:tp"] && [URI4.scheme isEqual: @"file"]) - TEST(@"-[user]", [URL1.user isEqual: @"us:er"] && URL4.user == nil) + TEST(@"-[user]", [URI1.user isEqual: @"us:er"] && URI4.user == nil) TEST(@"-[password]", - [URL1.password isEqual: @"p@w"] && URL4.password == nil) - TEST(@"-[host]", [URL1.host isEqual: @"ho:st"] && - [URL6.host isEqual: @"12:34::56:abcd"] && - [URL7.host isEqual: @"12:34::56:abcd"]) - TEST(@"-[port]", URL1.port.unsignedShortValue == 1234 && - [URL4 port] == nil && URL7.port.unsignedShortValue == 234) + [URI1.password isEqual: @"p@w"] && URI4.password == nil) + TEST(@"-[host]", [URI1.host isEqual: @"ho:st"] && + [URI6.host isEqual: @"12:34::56:abcd"] && + [URI7.host isEqual: @"12:34::56:abcd"]) + TEST(@"-[port]", URI1.port.unsignedShortValue == 1234 && + [URI4 port] == nil && URI7.port.unsignedShortValue == 234) TEST(@"-[path]", - [URL1.path isEqual: @"/pa?th"] && - [URL4.path isEqual: @"/etc/passwd"]) + [URI1.path isEqual: @"/pa?th"] && + [URI4.path isEqual: @"/etc/passwd"]) TEST(@"-[pathComponents]", - [URL1.pathComponents isEqual: + [URI1.pathComponents isEqual: [OFArray arrayWithObjects: @"/", @"pa?th", nil]] && - [URL4.pathComponents isEqual: + [URI4.pathComponents isEqual: [OFArray arrayWithObjects: @"/", @"etc", @"passwd", nil]] && - [URL5.pathComponents isEqual: + [URI5.pathComponents isEqual: [OFArray arrayWithObjects: @"/", @"bar", @"qux", @"foo/bar", nil]]) TEST(@"-[lastPathComponent]", - [[[OFURL URLWithString: @"http://host/foo//bar/baz"] + [[[OFURI URIWithString: @"http://host/foo//bar/baz"] lastPathComponent] isEqual: @"baz"] && - [[[OFURL URLWithString: @"http://host/foo//bar/baz/"] + [[[OFURI URIWithString: @"http://host/foo//bar/baz/"] lastPathComponent] isEqual: @"baz"] && - [[[OFURL URLWithString: @"http://host/foo/"] + [[[OFURI URIWithString: @"http://host/foo/"] lastPathComponent] isEqual: @"foo"] && - [[[OFURL URLWithString: @"http://host/"] + [[[OFURI URIWithString: @"http://host/"] lastPathComponent] isEqual: @"/"] && - [URL5.lastPathComponent isEqual: @"foo/bar"]) + [URI5.lastPathComponent isEqual: @"foo/bar"]) TEST(@"-[query]", - [URL1.query isEqual: @"que#ry=1&f&oo=b=ar"] && URL4.query == nil) + [URI1.query isEqual: @"que#ry=1&f&oo=b=ar"] && URI4.query == nil) TEST(@"-[queryDictionary]", - [URL1.queryDictionary isEqual: + [URI1.queryDictionary isEqual: [OFDictionary dictionaryWithKeysAndObjects: @"que#ry", @"1", @"f&oo", @"b=ar", nil]]); TEST(@"-[fragment]", - [URL1.fragment isEqual: @"frag#ment"] && URL4.fragment == nil) - - TEST(@"-[copy]", R(URL4 = [[URL1 copy] autorelease])) - - TEST(@"-[isEqual:]", [URL1 isEqual: URL4] && ![URL2 isEqual: URL3] && - [[OFURL URLWithString: @"HTTP://bar/"] isEqual: URL3]) - - TEST(@"-[hash:]", URL1.hash == URL4.hash && URL2.hash != URL3.hash) + [URI1.fragment isEqual: @"frag#ment"] && URI4.fragment == nil) + + TEST(@"-[copy]", R(URI4 = [[URI1 copy] autorelease])) + + TEST(@"-[isEqual:]", [URI1 isEqual: URI4] && ![URI2 isEqual: URI3] && + [[OFURI URIWithString: @"HTTP://bar/"] isEqual: URI3]) + + TEST(@"-[hash:]", URI1.hash == URI4.hash && URI2.hash != URI3.hash) EXPECT_EXCEPTION(@"Detection of invalid format", - OFInvalidFormatException, [OFURL URLWithString: @"http"]) + OFInvalidFormatException, [OFURI URIWithString: @"http"]) - mutableURL = [OFMutableURL URL]; + mutableURI = [OFMutableURI URI]; TEST(@"-[setScheme:]", - (mutableURL.scheme = @"ht:tp") && - [mutableURL.URLEncodedScheme isEqual: @"ht%3Atp"]) + (mutableURI.scheme = @"ht:tp") && + [mutableURI.percentEncodedScheme isEqual: @"ht%3Atp"]) - TEST(@"-[setURLEncodedScheme:]", - (mutableURL.URLEncodedScheme = @"ht%3Atp") && - [mutableURL.scheme isEqual: @"ht:tp"]) + TEST(@"-[setPercentEncodedScheme:]", + (mutableURI.percentEncodedScheme = @"ht%3Atp") && + [mutableURI.scheme isEqual: @"ht:tp"]) EXPECT_EXCEPTION( - @"-[setURLEncodedScheme:] with invalid characters fails", - OFInvalidFormatException, mutableURL.URLEncodedScheme = @"~") + @"-[setPercentEncodedScheme:] with invalid characters fails", + OFInvalidFormatException, mutableURI.percentEncodedScheme = @"~") TEST(@"-[setHost:]", - (mutableURL.host = @"ho:st") && - [mutableURL.URLEncodedHost isEqual: @"ho%3Ast"] && - (mutableURL.host = @"12:34:ab") && - [mutableURL.URLEncodedHost isEqual: @"[12:34:ab]"] && - (mutableURL.host = @"12:34:aB") && - [mutableURL.URLEncodedHost isEqual: @"[12:34:aB]"] && - (mutableURL.host = @"12:34:g") && - [mutableURL.URLEncodedHost isEqual: @"12%3A34%3Ag"]) - - TEST(@"-[setURLEncodedHost:]", - (mutableURL.URLEncodedHost = @"ho%3Ast") && - [mutableURL.host isEqual: @"ho:st"] && - (mutableURL.URLEncodedHost = @"[12:34]") && - [mutableURL.host isEqual: @"12:34"] && - (mutableURL.URLEncodedHost = @"[12::ab]") && - [mutableURL.host isEqual: @"12::ab"]) - - EXPECT_EXCEPTION(@"-[setURLEncodedHost:] with invalid characters fails" - " #1", OFInvalidFormatException, mutableURL.URLEncodedHost = @"/") - - EXPECT_EXCEPTION(@"-[setURLEncodedHost:] with invalid characters fails" - " #2", OFInvalidFormatException, - mutableURL.URLEncodedHost = @"[12:34") - - EXPECT_EXCEPTION(@"-[setURLEncodedHost:] with invalid characters fails" - " #3", OFInvalidFormatException, - mutableURL.URLEncodedHost = @"[a::g]") + (mutableURI.host = @"ho:st") && + [mutableURI.percentEncodedHost isEqual: @"ho%3Ast"] && + (mutableURI.host = @"12:34:ab") && + [mutableURI.percentEncodedHost isEqual: @"[12:34:ab]"] && + (mutableURI.host = @"12:34:aB") && + [mutableURI.percentEncodedHost isEqual: @"[12:34:aB]"] && + (mutableURI.host = @"12:34:g") && + [mutableURI.percentEncodedHost isEqual: @"12%3A34%3Ag"]) + + TEST(@"-[setPercentEncodedHost:]", + (mutableURI.percentEncodedHost = @"ho%3Ast") && + [mutableURI.host isEqual: @"ho:st"] && + (mutableURI.percentEncodedHost = @"[12:34]") && + [mutableURI.host isEqual: @"12:34"] && + (mutableURI.percentEncodedHost = @"[12::ab]") && + [mutableURI.host isEqual: @"12::ab"]) + + EXPECT_EXCEPTION( + @"-[setPercentEncodedHost:] with invalid characters fails #1", + OFInvalidFormatException, + mutableURI.percentEncodedHost = @"/") + + EXPECT_EXCEPTION( + @"-[setPercentEncodedHost:] with invalid characters fails #2", + OFInvalidFormatException, + mutableURI.percentEncodedHost = @"[12:34") + + EXPECT_EXCEPTION( + @"-[setPercentEncodedHost:] with invalid characters fails #3", + OFInvalidFormatException, mutableURI.percentEncodedHost = @"[a::g]") TEST(@"-[setUser:]", - (mutableURL.user = @"us:er") && - [mutableURL.URLEncodedUser isEqual: @"us%3Aer"]) - - TEST(@"-[setURLEncodedUser:]", - (mutableURL.URLEncodedUser = @"us%3Aer") && - [mutableURL.user isEqual: @"us:er"]) - - EXPECT_EXCEPTION(@"-[setURLEncodedUser:] with invalid characters fails", - OFInvalidFormatException, mutableURL.URLEncodedHost = @"/") + (mutableURI.user = @"us:er") && + [mutableURI.percentEncodedUser isEqual: @"us%3Aer"]) + + TEST(@"-[setPercentEncodedUser:]", + (mutableURI.percentEncodedUser = @"us%3Aer") && + [mutableURI.user isEqual: @"us:er"]) + + EXPECT_EXCEPTION( + @"-[setPercentEncodedUser:] with invalid characters fails", + OFInvalidFormatException, + mutableURI.percentEncodedHost = @"/") TEST(@"-[setPassword:]", - (mutableURL.password = @"pass:word") && - [mutableURL.URLEncodedPassword isEqual: @"pass%3Aword"]) + (mutableURI.password = @"pass:word") && + [mutableURI.percentEncodedPassword isEqual: @"pass%3Aword"]) - TEST(@"-[setURLEncodedPassword:]", - (mutableURL.URLEncodedPassword = @"pass%3Aword") && - [mutableURL.password isEqual: @"pass:word"]) + TEST(@"-[setPercentEncodedPassword:]", + (mutableURI.percentEncodedPassword = @"pass%3Aword") && + [mutableURI.password isEqual: @"pass:word"]) EXPECT_EXCEPTION( - @"-[setURLEncodedPassword:] with invalid characters fails", - OFInvalidFormatException, mutableURL.URLEncodedPassword = @"/") + @"-[setPercentEncodedPassword:] with invalid characters fails", + OFInvalidFormatException, + mutableURI.percentEncodedPassword = @"/") TEST(@"-[setPath:]", - (mutableURL.path = @"pa/th@?") && - [mutableURL.URLEncodedPath isEqual: @"pa/th@%3F"]) - - TEST(@"-[setURLEncodedPath:]", - (mutableURL.URLEncodedPath = @"pa/th@%3F") && - [mutableURL.path isEqual: @"pa/th@?"]) - - EXPECT_EXCEPTION(@"-[setURLEncodedPath:] with invalid characters fails", - OFInvalidFormatException, mutableURL.URLEncodedPath = @"?") + (mutableURI.path = @"pa/th@?") && + [mutableURI.percentEncodedPath isEqual: @"pa/th@%3F"]) + + TEST(@"-[setPercentEncodedPath:]", + (mutableURI.percentEncodedPath = @"pa/th@%3F") && + [mutableURI.path isEqual: @"pa/th@?"]) + + EXPECT_EXCEPTION( + @"-[setPercentEncodedPath:] with invalid characters fails", + OFInvalidFormatException, + mutableURI.percentEncodedPath = @"?") TEST(@"-[setQuery:]", - (mutableURL.query = @"que/ry?#") && - [mutableURL.URLEncodedQuery isEqual: @"que/ry?%23"]) + (mutableURI.query = @"que/ry?#") && + [mutableURI.percentEncodedQuery isEqual: @"que/ry?%23"]) - TEST(@"-[setURLEncodedQuery:]", - (mutableURL.URLEncodedQuery = @"que/ry?%23") && - [mutableURL.query isEqual: @"que/ry?#"]) + TEST(@"-[setPercentEncodedQuery:]", + (mutableURI.percentEncodedQuery = @"que/ry?%23") && + [mutableURI.query isEqual: @"que/ry?#"]) EXPECT_EXCEPTION( - @"-[setURLEncodedQuery:] with invalid characters fails", - OFInvalidFormatException, mutableURL.URLEncodedQuery = @"`") + @"-[setPercentEncodedQuery:] with invalid characters fails", + OFInvalidFormatException, + mutableURI.percentEncodedQuery = @"`") TEST(@"-[setQueryDictionary:]", - (mutableURL.queryDictionary = + (mutableURI.queryDictionary = [OFDictionary dictionaryWithKeysAndObjects: @"foo&bar", @"baz=qux", @"f=oobar", @"b&azqux", nil]) && - [mutableURL.URLEncodedQuery isEqual: + [mutableURI.percentEncodedQuery isEqual: @"foo%26bar=baz%3Dqux&f%3Doobar=b%26azqux"]) TEST(@"-[setFragment:]", - (mutableURL.fragment = @"frag/ment?#") && - [mutableURL.URLEncodedFragment isEqual: @"frag/ment?%23"]) + (mutableURI.fragment = @"frag/ment?#") && + [mutableURI.percentEncodedFragment isEqual: @"frag/ment?%23"]) - TEST(@"-[setURLEncodedFragment:]", - (mutableURL.URLEncodedFragment = @"frag/ment?%23") && - [mutableURL.fragment isEqual: @"frag/ment?#"]) + TEST(@"-[setPercentEncodedFragment:]", + (mutableURI.percentEncodedFragment = @"frag/ment?%23") && + [mutableURI.fragment isEqual: @"frag/ment?#"]) EXPECT_EXCEPTION( - @"-[setURLEncodedFragment:] with invalid characters fails", - OFInvalidFormatException, mutableURL.URLEncodedFragment = @"`") - - TEST(@"-[URLByAppendingPathComponent:isDirectory:]", - [[[OFURL URLWithString: @"file:///foo/bar"] - URLByAppendingPathComponent: @"qux" isDirectory: false] isEqual: - [OFURL URLWithString: @"file:///foo/bar/qux"]] && - [[[OFURL URLWithString: @"file:///foo/bar/"] - URLByAppendingPathComponent: @"qux" isDirectory: false] isEqual: - [OFURL URLWithString: @"file:///foo/bar/qux"]] && - [[[OFURL URLWithString: @"file:///foo/bar/"] - URLByAppendingPathComponent: @"qu?x" isDirectory: false] isEqual: - [OFURL URLWithString: @"file:///foo/bar/qu%3Fx"]] && - [[[OFURL URLWithString: @"file:///foo/bar/"] - URLByAppendingPathComponent: @"qu?x" isDirectory: true] isEqual: - [OFURL URLWithString: @"file:///foo/bar/qu%3Fx/"]]) - - TEST(@"-[URLByStandardizingPath]", - [[[OFURL URLWithString: @"http://foo/bar/.."] - URLByStandardizingPath] isEqual: - [OFURL URLWithString: @"http://foo/"]] && - [[[OFURL URLWithString: @"http://foo/bar/%2E%2E/../qux/"] - URLByStandardizingPath] isEqual: - [OFURL URLWithString: @"http://foo/bar/qux/"]] && - [[[OFURL URLWithString: @"http://foo/bar/./././qux/./"] - URLByStandardizingPath] isEqual: - [OFURL URLWithString: @"http://foo/bar/qux/"]] && - [[[OFURL URLWithString: @"http://foo/bar/../../qux"] - URLByStandardizingPath] isEqual: - [OFURL URLWithString: @"http://foo/../qux"]]) + @"-[setPercentEncodedFragment:] with invalid characters fails", + OFInvalidFormatException, + mutableURI.percentEncodedFragment = @"`") + + TEST(@"-[URIByAppendingPathComponent:isDirectory:]", + [[[OFURI URIWithString: @"file:///foo/bar"] + URIByAppendingPathComponent: @"qux" isDirectory: false] isEqual: + [OFURI URIWithString: @"file:///foo/bar/qux"]] && + [[[OFURI URIWithString: @"file:///foo/bar/"] + URIByAppendingPathComponent: @"qux" isDirectory: false] isEqual: + [OFURI URIWithString: @"file:///foo/bar/qux"]] && + [[[OFURI URIWithString: @"file:///foo/bar/"] + URIByAppendingPathComponent: @"qu?x" isDirectory: false] isEqual: + [OFURI URIWithString: @"file:///foo/bar/qu%3Fx"]] && + [[[OFURI URIWithString: @"file:///foo/bar/"] + URIByAppendingPathComponent: @"qu?x" isDirectory: true] isEqual: + [OFURI URIWithString: @"file:///foo/bar/qu%3Fx/"]]) + + TEST(@"-[URIByStandardizingPath]", + [[[OFURI URIWithString: @"http://foo/bar/.."] + URIByStandardizingPath] isEqual: + [OFURI URIWithString: @"http://foo/"]] && + [[[OFURI URIWithString: @"http://foo/bar/%2E%2E/../qux/"] + URIByStandardizingPath] isEqual: + [OFURI URIWithString: @"http://foo/bar/qux/"]] && + [[[OFURI URIWithString: @"http://foo/bar/./././qux/./"] + URIByStandardizingPath] isEqual: + [OFURI URIWithString: @"http://foo/bar/qux/"]] && + [[[OFURI URIWithString: @"http://foo/bar/../../qux"] + URIByStandardizingPath] isEqual: + [OFURI URIWithString: @"http://foo/../qux"]]) objc_autoreleasePoolPop(pool); } @end