Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(224)

Unified Diff: src/pkg/http/url_test.go

Issue 582043: code review 582043: http: change RawPath to mean raw path, not raw everythi... (Closed)
Patch Set: code review 582043: http: change RawPath to mean raw path, not raw everythi... Created 15 years ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pkg/http/url.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pkg/http/url_test.go
===================================================================
--- a/src/pkg/http/url_test.go
+++ b/src/pkg/http/url_test.go
@@ -27,10 +27,10 @@
URLTest{
"http://www.google.com",
&URL{
- "http://www.google.com",
- "http", "//www.google.com",
- "www.google.com", "", "www.google.com",
- "", "", "",
+ Raw: "http://www.google.com",
+ Scheme: "http",
+ Authority: "www.google.com",
+ Host: "www.google.com",
},
"",
},
@@ -38,21 +38,25 @@
URLTest{
"http://www.google.com/",
&URL{
- "http://www.google.com/",
- "http", "//www.google.com/",
- "www.google.com", "", "www.google.com",
- "/", "", "",
+ Raw: "http://www.google.com/",
+ Scheme: "http",
+ Authority: "www.google.com",
+ Host: "www.google.com",
+ RawPath: "/",
+ Path: "/",
},
"",
},
- // path with hex escaping... note that space roundtrips to +
+ // path with hex escaping
URLTest{
"http://www.google.com/file%20one%26two",
&URL{
- "http://www.google.com/file%20one%26two",
- "http", "//www.google.com/file%20one%26two",
- "www.google.com", "", "www.google.com",
- "/file one&two", "", "",
+ Raw: "http://www.google.com/file%20one%26two",
+ Scheme: "http",
+ Authority: "www.google.com",
+ Host: "www.google.com",
+ RawPath: "/file%20one%26two",
+ Path: "/file one&two",
},
"http://www.google.com/file%20one%26two",
},
@@ -60,10 +64,13 @@
URLTest{
"ftp://webmaster@www.google.com/",
&URL{
- "ftp://webmaster@www.google.com/",
- "ftp", "//webmaster@www.google.com/",
- "webmaster@www.google.com", "webmaster", "www.google.com",
- "/", "", "",
+ Raw: "ftp://webmaster@www.google.com/",
+ Scheme: "ftp",
+ Authority: "webmaster@www.google.com",
+ Userinfo: "webmaster",
+ Host: "www.google.com",
+ RawPath: "/",
+ Path: "/",
},
"",
},
@@ -71,10 +78,13 @@
URLTest{
"ftp://john%20doe@www.google.com/",
&URL{
- "ftp://john%20doe@www.google.com/",
- "ftp", "//john%20doe@www.google.com/",
- "john doe@www.google.com", "john doe", "www.google.com",
- "/", "", "",
+ Raw: "ftp://john%20doe@www.google.com/",
+ Scheme: "ftp",
+ Authority: "john doe@www.google.com",
+ Userinfo: "john doe",
+ Host: "www.google.com",
+ RawPath: "/",
+ Path: "/",
},
"ftp://john%20doe@www.google.com/",
},
@@ -82,10 +92,13 @@
URLTest{
"http://www.google.com/?q=go+language",
&URL{
- "http://www.google.com/?q=go+language",
- "http", "//www.google.com/?q=go+language",
- "www.google.com", "", "www.google.com",
- "/", "q=go+language", "",
+ Raw: "http://www.google.com/?q=go+language",
+ Scheme: "http",
+ Authority: "www.google.com",
+ Host: "www.google.com",
+ RawPath: "/?q=go+language",
+ Path: "/",
+ RawQuery: "q=go+language",
},
"",
},
@@ -93,10 +106,13 @@
URLTest{
"http://www.google.com/?q=go%20language",
&URL{
- "http://www.google.com/?q=go%20language",
- "http", "//www.google.com/?q=go%20language",
- "www.google.com", "", "www.google.com",
- "/", "q=go%20language", "",
+ Raw: "http://www.google.com/?q=go%20language",
+ Scheme: "http",
+ Authority: "www.google.com",
+ Host: "www.google.com",
+ RawPath: "/?q=go%20language",
+ Path: "/",
+ RawQuery: "q=go%20language",
},
"",
},
@@ -104,10 +120,13 @@
URLTest{
"http://www.google.com/a%20b?q=c+d",
&URL{
- "http://www.google.com/a%20b?q=c+d",
- "http", "//www.google.com/a%20b?q=c+d",
- "www.google.com", "", "www.google.com",
- "/a b", "q=c+d", "",
+ Raw: "http://www.google.com/a%20b?q=c+d",
+ Scheme: "http",
+ Authority: "www.google.com",
+ Host: "www.google.com",
+ RawPath: "/a%20b?q=c+d",
+ Path: "/a b",
+ RawQuery: "q=c+d",
},
"",
},
@@ -115,10 +134,10 @@
URLTest{
"http:www.google.com/?q=go+language",
&URL{
- "http:www.google.com/?q=go+language",
- "http", "www.google.com/?q=go+language",
- "", "", "",
- "www.google.com/?q=go+language", "", "",
+ Raw: "http:www.google.com/?q=go+language",
+ Scheme: "http",
+ RawPath: "www.google.com/?q=go+language",
+ Path: "www.google.com/?q=go+language",
},
"http:www.google.com/%3fq%3dgo%2blanguage",
},
@@ -126,10 +145,10 @@
URLTest{
"mailto:/webmaster@golang.org",
&URL{
- "mailto:/webmaster@golang.org",
- "mailto", "/webmaster@golang.org",
- "", "", "",
- "/webmaster@golang.org", "", "",
+ Raw: "mailto:/webmaster@golang.org",
+ Scheme: "mailto",
+ RawPath: "/webmaster@golang.org",
+ Path: "/webmaster@golang.org",
},
"",
},
@@ -137,10 +156,10 @@
URLTest{
"mailto:webmaster@golang.org",
&URL{
- "mailto:webmaster@golang.org",
- "mailto", "webmaster@golang.org",
- "", "", "",
- "webmaster@golang.org", "", "",
+ Raw: "mailto:webmaster@golang.org",
+ Scheme: "mailto",
+ RawPath: "webmaster@golang.org",
+ Path: "webmaster@golang.org",
},
"",
},
@@ -148,10 +167,10 @@
URLTest{
"/foo?query=http://bad",
&URL{
- "/foo?query=http://bad",
- "", "/foo?query=http://bad",
- "", "", "",
- "/foo", "query=http://bad", "",
+ Raw: "/foo?query=http://bad",
+ RawPath: "/foo?query=http://bad",
+ Path: "/foo",
+ RawQuery: "query=http://bad",
},
"",
},
@@ -161,10 +180,13 @@
URLTest{
"http://www.google.com/?q=go+language#foo",
&URL{
- "http://www.google.com/?q=go+language#foo",
- "http", "//www.google.com/?q=go+language#foo",
- "www.google.com", "", "www.google.com",
- "/", "q=go+language#foo", "",
+ Raw: "http://www.google.com/?q=go+language#foo",
+ Scheme: "http",
+ Authority: "www.google.com",
+ Host: "www.google.com",
+ RawPath: "/?q=go+language#foo",
+ Path: "/",
+ RawQuery: "q=go+language#foo",
},
"",
},
@@ -174,20 +196,28 @@
URLTest{
"http://www.google.com/?q=go+language#foo",
&URL{
- "http://www.google.com/?q=go+language",
- "http", "//www.google.com/?q=go+language",
- "www.google.com", "", "www.google.com",
- "/", "q=go+language", "foo",
+ Raw: "http://www.google.com/?q=go+language#foo",
+ Scheme: "http",
+ Authority: "www.google.com",
+ Host: "www.google.com",
+ RawPath: "/?q=go+language#foo",
+ Path: "/",
+ RawQuery: "q=go+language",
+ Fragment: "foo",
},
"",
},
URLTest{
"http://www.google.com/?q=go+language#foo%26bar",
&URL{
- "http://www.google.com/?q=go+language",
- "http", "//www.google.com/?q=go+language",
- "www.google.com", "", "www.google.com",
- "/", "q=go+language", "foo&bar",
+ Raw: "http://www.google.com/?q=go+language#foo%26bar",
+ Scheme: "http",
+ Authority: "www.google.com",
+ Host: "www.google.com",
+ RawPath: "/?q=go+language#foo%26bar",
+ Path: "/",
+ RawQuery: "q=go+language",
+ Fragment: "foo&bar",
},
"",
},
« no previous file with comments | « src/pkg/http/url.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b