for i, tt := range writeSetCookiesTests {
if g, e := tt.Cookie.String(), tt.Raw; g != e {
t.Errorf("Test %d, expecting:\n%s\nGot:\n%s\n", i, e, g)
- continue
}
}
}
if g := req.Header.Get("Cookie"); g != tt.Raw {
t.Errorf("Test %d:\nwant: %s\n got: %s\n", i, tt.Raw, g)
- continue
}
}
}
c := readSetCookies(tt.Header)
if !reflect.DeepEqual(c, tt.Cookies) {
t.Errorf("#%d readSetCookies: have\n%s\nwant\n%s\n", i, toJSON(c), toJSON(tt.Cookies))
- continue
}
}
}
c := readCookies(tt.Header, tt.Filter)
if !reflect.DeepEqual(c, tt.Cookies) {
t.Errorf("#%d readCookies:\nhave: %s\nwant: %s\n", i, toJSON(c), toJSON(tt.Cookies))
- continue
}
}
}
gotCookie, gotErr := ParseSetCookie(tt.line)
if !errors.Is(gotErr, tt.err) {
t.Errorf("#%d ParseSetCookie got error %v, want error %v", i, gotErr, tt.err)
+ continue
}
if !reflect.DeepEqual(gotCookie, tt.cookie) {
t.Errorf("#%d ParseSetCookie:\ngot cookie: %s\nwant cookie: %s\n", i, toJSON(gotCookie), toJSON(tt.cookie))