]> Cypherpunks repositories - gostls13.git/commitdiff
http: fix redirect test for international users
authorAndrew Gerrand <adg@golang.org>
Thu, 23 Sep 2010 00:40:07 +0000 (10:40 +1000)
committerAndrew Gerrand <adg@golang.org>
Thu, 23 Sep 2010 00:40:07 +0000 (10:40 +1000)
R=r
CC=golang-dev
https://golang.org/cl/2197047

src/pkg/http/request_test.go

index cc9e78a6dc0e21f70023340c1130fc37c16814ba..102997182439b1d300b8638bcb9278cff73f0c28 100644 (file)
@@ -7,6 +7,7 @@ package http
 import (
        "bytes"
        "reflect"
+       "regexp"
        "strings"
        "testing"
 )
@@ -140,14 +141,15 @@ func TestMultipartReader(t *testing.T) {
 func TestRedirect(t *testing.T) {
        const (
                start = "http://google.com/"
-               end   = "http://www.google.com/"
+               endRe = "^http://www\\.google\\.[a-z.]+/$"
        )
+       var end = regexp.MustCompile(endRe)
        r, url, err := Get(start)
        if err != nil {
                t.Fatal(err)
        }
        r.Body.Close()
-       if r.StatusCode != 200 || url != end {
-               t.Fatalf("Get(%s) got status %d at %s, want 200 at %s", start, r.StatusCode, url, end)
+       if r.StatusCode != 200 || !end.MatchString(url) {
+               t.Fatalf("Get(%s) got status %d at %q, want 200 matching %q", start, r.StatusCode, url, endRe)
        }
 }