33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
OFURL *u1, *u2, *u3, *u4;
TEST(@"+[URLWithString:]",
R(u1 = [OFURL URLWithString: url_str]) &&
R(u2 = [OFURL URLWithString: @"http://foo:80"]) &&
R(u3 = [OFURL URLWithString: @"http://bar/"]))
TEST(@"-[description]",
[[u1 description] isEqual: url_str] &&
[[u2 description] isEqual: @"http://foo"] &&
[[u3 description] isEqual: @"http://bar/"])
TEST(@"-[scheme]", [[u1 scheme] isEqual: @"http"])
TEST(@"-[user]", [[u1 user] isEqual: @"u"])
|
>
>
>
>
>
>
>
>
>
>
>
>
>
|
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
OFURL *u1, *u2, *u3, *u4;
TEST(@"+[URLWithString:]",
R(u1 = [OFURL URLWithString: url_str]) &&
R(u2 = [OFURL URLWithString: @"http://foo:80"]) &&
R(u3 = [OFURL URLWithString: @"http://bar/"]))
TEST(@"+[URLWithString:relativeToURL:]",
[[[OFURL URLWithString: @"/foo"
relativeToURL: u1] description] isEqual:
@"http://u:p@h:1234/foo"] &&
[[[OFURL URLWithString: @"foo/bar?q"
relativeToURL: [OFURL URLWithString: @"http://h/qux/quux"]]
description] isEqual: @"http://h/qux/foo/bar?q"] &&
[[[OFURL URLWithString: @"foo/bar"
relativeToURL: [OFURL URLWithString: @"http://h/qux/?x"]]
description] isEqual: @"http://h/qux/foo/bar"] &&
[[[OFURL URLWithString: @"http://foo/?q"
relativeToURL: u1] description] isEqual: @"http://foo/?q"])
TEST(@"-[description]",
[[u1 description] isEqual: url_str] &&
[[u2 description] isEqual: @"http://foo"] &&
[[u3 description] isEqual: @"http://bar/"])
TEST(@"-[scheme]", [[u1 scheme] isEqual: @"http"])
TEST(@"-[user]", [[u1 user] isEqual: @"u"])
|