]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: correct error messages for TestParseSetCookie
authorJes Cok <xigua67damn@gmail.com>
Sat, 20 Apr 2024 08:27:17 +0000 (16:27 +0800)
committerGopher Robot <gobot@golang.org>
Mon, 22 Apr 2024 22:06:46 +0000 (22:06 +0000)
This change fixes typos in error messages, while here, also improves
'line' strings to indicate the errEqualNotFoundInCookie error.

Change-Id: I0ce6115c605844d2d86f337f208fd3b2d3774674
Reviewed-on: https://go-review.googlesource.com/c/go/+/579799
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Joedian Reid <joedian@google.com>
Auto-Submit: Damien Neil <dneil@google.com>

src/net/http/cookie_test.go

index de476825cf08956b90397a6f362bd0312e8af254..fdbe2723e3d417865ffe30abf818e9e013cbf84c 100644 (file)
@@ -709,7 +709,7 @@ func TestParseCookie(t *testing.T) {
                        err:  errBlankCookie,
                },
                {
-                       line: "whatever",
+                       line: "equal-not-found",
                        err:  errEqualNotFoundInCookie,
                },
                {
@@ -867,7 +867,7 @@ func TestParseSetCookie(t *testing.T) {
                        err:  errBlankCookie,
                },
                {
-                       line: "whatever",
+                       line: "equal-not-found",
                        err:  errEqualNotFoundInCookie,
                },
                {
@@ -882,10 +882,10 @@ func TestParseSetCookie(t *testing.T) {
        for i, tt := range tests {
                gotCookie, gotErr := ParseSetCookie(tt.line)
                if !errors.Is(gotErr, tt.err) {
-                       t.Errorf("#%d ParseCookie got error %v, want error %v", i, gotErr, tt.err)
+                       t.Errorf("#%d ParseSetCookie got error %v, want error %v", i, gotErr, tt.err)
                }
                if !reflect.DeepEqual(gotCookie, tt.cookie) {
-                       t.Errorf("#%d ParseCookie:\ngot cookie: %s\nwant cookie: %s\n", i, toJSON(gotCookie), toJSON(tt.cookie))
+                       t.Errorf("#%d ParseSetCookie:\ngot cookie: %s\nwant cookie: %s\n", i, toJSON(gotCookie), toJSON(tt.cookie))
                }
        }
 }