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

Delta Between Two Patch Sets: src/pkg/http/url_test.go

Issue 2985042: code review 2985042: http: Add EncodeQuery, a handy helper function for cons... (Closed)
Left Patch Set: code review 2985042: http: Add EncodeQuery, a handy helper function for cons... Created 14 years, 4 months ago
Right Patch Set: code review 2985042: http: Add EncodeQuery, a handy helper function for cons... Created 14 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/http/url.go ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package http 5 package http
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "os" 9 "os"
10 "reflect" 10 "reflect"
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 } 501 }
502 502
503 func TestUnescapeUserinfo(t *testing.T) { 503 func TestUnescapeUserinfo(t *testing.T) {
504 for _, tt := range userinfoTests { 504 for _, tt := range userinfoTests {
505 if user, pass, err := UnescapeUserinfo(tt.Raw); user != tt.User || pass != tt.Password || err != nil { 505 if user, pass, err := UnescapeUserinfo(tt.Raw); user != tt.User || pass != tt.Password || err != nil {
506 t.Errorf("UnescapeUserinfo(%q) = %q, %q, %v, want %q, %q , nil", tt.Raw, user, pass, err, tt.User, tt.Password) 506 t.Errorf("UnescapeUserinfo(%q) = %q, %q, %v, want %q, %q , nil", tt.Raw, user, pass, err, tt.User, tt.Password)
507 } 507 }
508 } 508 }
509 } 509 }
510 510
511 type qMap map[string][]interface{} 511 type qMap map[string][]string
512 512
513 type EncodeQueryTest struct { 513 type EncodeQueryTest struct {
514 m qMap 514 m qMap
515 expected string 515 expected string
516 } 516 }
517 517
518 var encodeQueryTests = []EncodeQueryTest{ 518 var encodeQueryTests = []EncodeQueryTest{
519 {nil, ""}, 519 {nil, ""},
520 {qMap{"q": {"puppies"}, "oe": {"utf8"}}, "q=puppies&oe=utf8"}, 520 {qMap{"q": {"puppies"}, "oe": {"utf8"}}, "q=puppies&oe=utf8"},
521 » {qMap{"q": {"dogs", "&", 7}}, "q=dogs&q=%26&q=7"}, 521 » {qMap{"q": {"dogs", "&", "7"}}, "q=dogs&q=%26&q=7"},
522 } 522 }
523 523
524 func TestEncodeQuery(t *testing.T) { 524 func TestEncodeQuery(t *testing.T) {
525 for _, tt := range encodeQueryTests { 525 for _, tt := range encodeQueryTests {
526 if q := EncodeQuery(tt.m); q != tt.expected { 526 if q := EncodeQuery(tt.m); q != tt.expected {
527 t.Errorf(`EncodeQuery(%+v) = %q, want %q`, tt.m, q, tt.e xpected) 527 t.Errorf(`EncodeQuery(%+v) = %q, want %q`, tt.m, q, tt.e xpected)
528 } 528 }
529 } 529 }
530 } 530 }
LEFTRIGHT

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