]>
git.saurik.com Git - apt.git/blob - test/libapt/uri_test.cc
1 #include <apt-pkg/strutl.h>
8 URI
U("http://www.debian.org:90/temp/test");
9 equals("http", U
.Access
);
11 equals("", U
.Password
);
13 equals("www.debian.org", U
.Host
);
14 equals("/temp/test", U
.Path
);
16 URI
U("http://jgg:foo@ualberta.ca/blah");
17 equals("http", U
.Access
);
18 equals("jgg", U
.User
);
19 equals("foo", U
.Password
);
21 equals("ualberta.ca", U
.Host
);
22 equals("/blah", U
.Path
);
24 URI
U("file:/usr/bin/foo");
25 equals("file", U
.Access
);
27 equals("", U
.Password
);
30 equals("/usr/bin/foo", U
.Path
);
32 URI
U("cdrom:Moo Cow Rom:/debian");
33 equals("cdrom", U
.Access
);
35 equals("", U
.Password
);
37 equals("Moo Cow Rom", U
.Host
);
38 equals("/debian", U
.Path
);
40 URI
U("gzip:./bar/cow");
41 equals("gzip", U
.Access
);
43 equals("", U
.Password
);
46 equals("/bar/cow", U
.Path
);
48 URI
U("ftp:ftp.fr.debian.org/debian/pool/main/x/xtel/xtel_3.2.1-15_i386.deb");
49 equals("ftp", U
.Access
);
51 equals("", U
.Password
);
53 equals("ftp.fr.debian.org", U
.Host
);
54 equals("/debian/pool/main/x/xtel/xtel_3.2.1-15_i386.deb", U
.Path
);
59 URI
U("http://[1080::8:800:200C:417A]/foo");
60 equals("http", U
.Access
);
62 equals("", U
.Password
);
64 equals("1080::8:800:200C:417A", U
.Host
);
65 equals("/foo", U
.Path
);
67 URI
U("http://[::FFFF:129.144.52.38]:80/index.html");
68 equals("http", U
.Access
);
70 equals("", U
.Password
);
72 equals("::FFFF:129.144.52.38", U
.Host
);
73 equals("/index.html", U
.Path
);
75 URI
U("http://[::FFFF:129.144.52.38:]:80/index.html");
76 equals("http", U
.Access
);
78 equals("", U
.Password
);
80 equals("::FFFF:129.144.52.38:", U
.Host
);
81 equals("/index.html", U
.Path
);
83 URI
U("http://[::FFFF:129.144.52.38:]/index.html");
84 equals("http", U
.Access
);
86 equals("", U
.Password
);
88 equals("::FFFF:129.144.52.38:", U
.Host
);
89 equals("/index.html", U
.Path
);
91 /* My Evil Corruption of RFC 2732 to handle CDROM names! Fun for
94 URI
U("cdrom:[The Debian 1.2 disk, 1/2 R1:6]/debian/");
95 equals("cdrom", U
.Access
);
97 equals("", U
.Password
);
99 equals("The Debian 1.2 disk, 1/2 R1:6", U
.Host
);
100 equals("/debian/", U
.Path
);
102 URI
U("cdrom:Foo Bar Cow/debian/");
103 equals("cdrom", U
.Access
);
105 equals("", U
.Password
);
107 equals("Foo Bar Cow", U
.Host
);
108 equals("/debian/", U
.Path
);