]>
git.saurik.com Git - apt.git/blob - test/libapt/uri_test.cc
3 #include <apt-pkg/strutl.h>
12 URI
U("http://www.debian.org:90/temp/test");
13 equals("http", U
.Access
);
15 equals("", U
.Password
);
17 equals("www.debian.org", U
.Host
);
18 equals("/temp/test", U
.Path
);
20 URI
U("http://jgg:foo@ualberta.ca/blah");
21 equals("http", U
.Access
);
22 equals("jgg", U
.User
);
23 equals("foo", U
.Password
);
25 equals("ualberta.ca", U
.Host
);
26 equals("/blah", U
.Path
);
28 URI
U("file:/usr/bin/foo");
29 equals("file", U
.Access
);
31 equals("", U
.Password
);
34 equals("/usr/bin/foo", U
.Path
);
36 URI
U("cdrom:Moo Cow Rom:/debian");
37 equals("cdrom", U
.Access
);
39 equals("", U
.Password
);
41 equals("Moo Cow Rom", U
.Host
);
42 equals("/debian", U
.Path
);
44 URI
U("gzip:./bar/cow");
45 equals("gzip", U
.Access
);
47 equals("", U
.Password
);
50 equals("/bar/cow", U
.Path
);
52 URI
U("ftp:ftp.fr.debian.org/debian/pool/main/x/xtel/xtel_3.2.1-15_i386.deb");
53 equals("ftp", U
.Access
);
55 equals("", U
.Password
);
57 equals("ftp.fr.debian.org", U
.Host
);
58 equals("/debian/pool/main/x/xtel/xtel_3.2.1-15_i386.deb", U
.Path
);
63 URI
U("http://[1080::8:800:200C:417A]/foo");
64 equals("http", U
.Access
);
66 equals("", U
.Password
);
68 equals("1080::8:800:200C:417A", U
.Host
);
69 equals("/foo", U
.Path
);
71 URI
U("http://[::FFFF:129.144.52.38]:80/index.html");
72 equals("http", U
.Access
);
74 equals("", U
.Password
);
76 equals("::FFFF:129.144.52.38", U
.Host
);
77 equals("/index.html", U
.Path
);
79 URI
U("http://[::FFFF:129.144.52.38:]:80/index.html");
80 equals("http", U
.Access
);
82 equals("", U
.Password
);
84 equals("::FFFF:129.144.52.38:", U
.Host
);
85 equals("/index.html", U
.Path
);
87 URI
U("http://[::FFFF:129.144.52.38:]/index.html");
88 equals("http", U
.Access
);
90 equals("", U
.Password
);
92 equals("::FFFF:129.144.52.38:", U
.Host
);
93 equals("/index.html", U
.Path
);
95 /* My Evil Corruption of RFC 2732 to handle CDROM names! Fun for
98 URI
U("cdrom:[The Debian 1.2 disk, 1/2 R1:6]/debian/");
99 equals("cdrom", U
.Access
);
101 equals("", U
.Password
);
103 equals("The Debian 1.2 disk, 1/2 R1:6", U
.Host
);
104 equals("/debian/", U
.Path
);
106 URI
U("cdrom:Foo Bar Cow/debian/");
107 equals("cdrom", U
.Access
);
109 equals("", U
.Password
);
111 equals("Foo Bar Cow", U
.Host
);
112 equals("/debian/", U
.Path
);
117 URI
U("ftp://foo:b%40r@example.org");
118 equals("foo", U
.User
);
119 equals("b@r", U
.Password
);
120 equals("ftp://foo:b%40r@example.org/", (std::string
) U
);