func testMissingFile(t *testing.T, req *Request) {
f, fh, err := req.FormFile("missing")
if f != nil {
- t.Errorf("FormFile file = %q, want nil", f, nil)
+ t.Errorf("FormFile file = %q, want nil", f)
}
if fh != nil {
- t.Errorf("FormFile file header = %q, want nil", fh, nil)
+ t.Errorf("FormFile file header = %q, want nil", fh)
}
if err != ErrMissingFile {
- t.Errorf("FormFile err = %q, want nil", err, ErrMissingFile)
+ t.Errorf("FormFile err = %q, want ErrMissingFile", err)
}
}
b := bytes.NewBufferString(strings.Replace(message, "\n", "\r\n", -1))
req, err := NewRequest("POST", "/", b)
if err != nil {
- t.Fatalf("NewRequest:", err)
+ t.Fatal("NewRequest:", err)
}
ctype := fmt.Sprintf(`multipart/form-data; boundary="%s"`, boundary)
req.Header.Set("Content-type", ctype)
func testMultipartFile(t *testing.T, req *Request, key, expectFilename, expectContent string) multipart.File {
f, fh, err := req.FormFile(key)
if err != nil {
- t.Fatalf("FormFile(%q):", key, err)
+ t.Fatalf("FormFile(%q): %q", key, err)
}
if fh.Filename != expectFilename {
t.Errorf("filename = %q, want %q", fh.Filename, expectFilename)
rest, err := ioutil.ReadAll(bufr)
checkErr(err, "ReadAll on remainder")
if e, g := "Next Request Here", string(rest); e != g {
- fatalf("for chunked=%v remainder = %q, expected %q", g, e)
+ fatalf("remainder = %q, expected %q", g, e)
}
}
}
hv := reflect.ValueOf(have).Elem()
wv := reflect.ValueOf(want).Elem()
if hv.Type() != wv.Type() {
- t.Errorf("%s: type mismatch %v vs %v", prefix, hv.Type(), wv.Type())
+ t.Errorf("%s: type mismatch %v want %v", prefix, hv.Type(), wv.Type())
}
for i := 0; i < hv.NumField(); i++ {
hf := hv.Field(i).Interface()
}
fi, err := os.Stat(u.HomeDir)
if err != nil || !fi.IsDirectory() {
- t.Errorf("expected a valid HomeDir; stat(%q): err=%v, IsDirectory=%v", err, fi.IsDirectory())
+ t.Errorf("expected a valid HomeDir; stat(%q): err=%v, IsDirectory=%v", u.HomeDir, err, fi.IsDirectory())
}
if u.Username == "" {
t.Fatalf("didn't get a username")