@@ -20,24 +20,11 @@ namespace nix {
2020 }
2121
2222
23- std::ostream& operator <<(std::ostream& os, const ParsedURL& p) {
24- return os << " \n "
25- << " url: " << p.url << " \n "
26- << " base: " << p.base << " \n "
27- << " scheme: " << p.scheme << " \n "
28- << " authority: " << p.authority .value () << " \n "
29- << " path: " << p.path << " \n "
30- << " query: " << print_map (p.query ) << " \n "
31- << " fragment: " << p.fragment << " \n " ;
32- }
33-
3423 TEST (parseURL, parsesSimpleHttpUrl) {
3524 auto s = " http://www.example.org/file.tar.gz" ;
3625 auto parsed = parseURL (s);
3726
3827 ParsedURL expected {
39- .url = " http://www.example.org/file.tar.gz" ,
40- .base = " http://www.example.org/file.tar.gz" ,
4128 .scheme = " http" ,
4229 .authority = " www.example.org" ,
4330 .path = " /file.tar.gz" ,
@@ -53,8 +40,6 @@ namespace nix {
5340 auto parsed = parseURL (s);
5441
5542 ParsedURL expected {
56- .url = " https://www.example.org/file.tar.gz" ,
57- .base = " https://www.example.org/file.tar.gz" ,
5843 .scheme = " https" ,
5944 .authority = " www.example.org" ,
6045 .path = " /file.tar.gz" ,
@@ -70,8 +55,6 @@ namespace nix {
7055 auto parsed = parseURL (s);
7156
7257 ParsedURL expected {
73- .url = " https://www.example.org/file.tar.gz" ,
74- .base = " https://www.example.org/file.tar.gz" ,
7558 .scheme = " https" ,
7659 .authority = " www.example.org" ,
7760 .path = " /file.tar.gz" ,
@@ -87,8 +70,6 @@ namespace nix {
8770 auto parsed = parseURL (s);
8871
8972 ParsedURL expected {
90- .url = " http://www.example.org/file.tar.gz" ,
91- .base = " http://www.example.org/file.tar.gz" ,
9273 .scheme = " http" ,
9374 .authority = " www.example.org" ,
9475 .path = " /file.tar.gz" ,
@@ -104,8 +85,6 @@ namespace nix {
10485 auto parsed = parseURL (s);
10586
10687 ParsedURL expected {
107- .url = " file+https://www.example.org/video.mp4" ,
108- .base = " https://www.example.org/video.mp4" ,
10988 .scheme = " file+https" ,
11089 .authority = " www.example.org" ,
11190 .path = " /video.mp4" ,
@@ -126,8 +105,6 @@ namespace nix {
126105 auto parsed = parseURL (s);
127106
128107 ParsedURL expected {
129- .url = " http://127.0.0.1:8080/file.tar.gz" ,
130- .base = " https://127.0.0.1:8080/file.tar.gz" ,
131108 .scheme = " http" ,
132109 .authority = " 127.0.0.1:8080" ,
133110 .path = " /file.tar.gz" ,
@@ -143,8 +120,6 @@ namespace nix {
143120 auto parsed = parseURL (s);
144121
145122 ParsedURL expected {
146- .url = " http://[fe80::818c:da4d:8975:415c\%enp0s25]:8080" ,
147- .base = " http://[fe80::818c:da4d:8975:415c\%enp0s25]:8080" ,
148123 .scheme = " http" ,
149124 .authority = " [fe80::818c:da4d:8975:415c\%enp0s25]:8080" ,
150125 .path = " " ,
@@ -161,8 +136,6 @@ namespace nix {
161136 auto parsed = parseURL (s);
162137
163138 ParsedURL expected {
164- .url = " http://[2a02:8071:8192:c100:311d:192d:81ac:11ea]:8080" ,
165- .base = " http://[2a02:8071:8192:c100:311d:192d:81ac:11ea]:8080" ,
166139 .scheme = " http" ,
167140 .authority = " [2a02:8071:8192:c100:311d:192d:81ac:11ea]:8080" ,
168141 .path = " " ,
@@ -185,8 +158,6 @@ namespace nix {
185158 auto parsed = parseURL (s);
186159
187160 ParsedURL expected {
188- .
url =
" http://user:[email protected] /file.tar.gz" ,
189- .
base =
" http://user:[email protected] /file.tar.gz" ,
190161 .scheme = " http" ,
191162 .
authority =
" user:[email protected] :8080" ,
192163 .path = " /file.tar.gz" ,
@@ -203,8 +174,6 @@ namespace nix {
203174 auto parsed = parseURL (s);
204175
205176 ParsedURL expected {
206- .url = " " ,
207- .base = " " ,
208177 .scheme = " file" ,
209178 .authority = " " ,
210179 .path = " /none/of//your/business" ,
@@ -228,8 +197,6 @@ namespace nix {
228197 auto parsed = parseURL (s);
229198
230199 ParsedURL expected {
231- .url = " ftp://ftp.nixos.org/downloads/nixos.iso" ,
232- .base = " ftp://ftp.nixos.org/downloads/nixos.iso" ,
233200 .scheme = " ftp" ,
234201 .authority = " ftp.nixos.org" ,
235202 .path = " /downloads/nixos.iso" ,
0 commit comments