Skip to content

Commit

Permalink
code style fix
Browse files Browse the repository at this point in the history
  • Loading branch information
qiangxue committed Dec 5, 2019
1 parent 38b01d2 commit 4f4446e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
24 changes: 12 additions & 12 deletions reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ func TestReadForm(t *testing.T) {
D []int
}
values := map[string][]string{
"x1": []string{"abc", "123"},
"A1": []string{"a1"},
"x2": []string{"1", "2"},
"B.B1": []string{"b1", "b2"},
"B.B2": []string{"true"},
"B.B3": []string{"1.23"},
"c.B1": []string{"fb1", "fb2"},
"e.B1": []string{"fe1", "fe2"},
"c": []string{"100"},
"D": []string{"100", "200", "300"},
"x1": {"abc", "123"},
"A1": {"a1"},
"x2": {"1", "2"},
"B.B1": {"b1", "b2"},
"B.B2": {"true"},
"B.B3": {"1.23"},
"c.B1": {"fb1", "fb2"},
"e.B1": {"fe1", "fe2"},
"c": {"100"},
"D": {"100", "200", "300"},
}
err := ReadFormData(values, &a)
assert.Nil(t, err)
Expand Down Expand Up @@ -100,8 +100,8 @@ func TestTextUnmarshaler(t *testing.T) {
NTU string `form:"ntu"`
}
values := map[string][]string{
"atu": []string{"ORIGINAL"},
"ntu": []string{"ORIGINAL"},
"atu": {"ORIGINAL"},
"ntu": {"ORIGINAL"},
}
err := ReadFormData(values, &a)
assert.Nil(t, err)
Expand Down
3 changes: 3 additions & 0 deletions slash/remover_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,23 @@ func TestRemover(t *testing.T) {
req, _ = http.NewRequest("GET", "/", nil)
c = routing.NewContext(res, req)
err = h(c)
assert.Nil(t, err, "return value is nil")
assert.Equal(t, http.StatusOK, res.Code)
assert.Equal(t, "", res.Header().Get("Location"))

res = httptest.NewRecorder()
req, _ = http.NewRequest("GET", "/users", nil)
c = routing.NewContext(res, req)
err = h(c)
assert.Nil(t, err, "return value is nil")
assert.Equal(t, http.StatusOK, res.Code)
assert.Equal(t, "", res.Header().Get("Location"))

res = httptest.NewRecorder()
req, _ = http.NewRequest("POST", "/users/", nil)
c = routing.NewContext(res, req)
err = h(c)
assert.Nil(t, err, "return value is nil")
assert.Equal(t, http.StatusTemporaryRedirect, res.Code)
assert.Equal(t, "/users", res.Header().Get("Location"))
}

0 comments on commit 4f4446e

Please sign in to comment.