Skip to content

Commit

Permalink
add unit test for AllParams()
Browse files Browse the repository at this point in the history
add unit test for AllParams()
  • Loading branch information
xmh19936688 authored and workXMH committed Feb 25, 2020
1 parent b267c67 commit 5ea4410
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions context_test.go
Expand Up @@ -171,6 +171,18 @@ func Test_Context(t *testing.T) {
So(resp.Body.String(), ShouldEqual, "user user 1 13 1.24 ")
})

Convey("All Parameter", func() {
m.Get("/:arg/:param/:flag", func(ctx *Context) string {
return com.ToStr(len(ctx.AllParams()))
})

resp := httptest.NewRecorder()
req, err := http.NewRequest("GET", "/arg/param/flag", nil)
So(err, ShouldBeNil)
m.ServeHTTP(resp,req)
So(resp.Body.String(), ShouldEqual, "3")
})

Convey("Get file", func() {
m.Post("/getfile", func(ctx *Context) {
ctx.Query("")
Expand Down

0 comments on commit 5ea4410

Please sign in to comment.