update assert param(expect, actual) position (#1177)

This commit is contained in:
田欧
2017-11-21 21:18:45 +08:00
committed by Bo-Yi Wu
parent 7e5aff8ea7
commit eeb57848ca
9 changed files with 271 additions and 271 deletions
+10 -10
View File
@@ -20,15 +20,15 @@ func TestRouterGroupBasic(t *testing.T) {
group.Use(func(c *Context) {})
assert.Len(t, group.Handlers, 2)
assert.Equal(t, group.BasePath(), "/hola")
assert.Equal(t, group.engine, router)
assert.Equal(t, "/hola", group.BasePath())
assert.Equal(t, router, group.engine)
group2 := group.Group("manu")
group2.Use(func(c *Context) {}, func(c *Context) {})
assert.Len(t, group2.Handlers, 4)
assert.Equal(t, group2.BasePath(), "/hola/manu")
assert.Equal(t, group2.engine, router)
assert.Equal(t, "/hola/manu", group2.BasePath())
assert.Equal(t, router, group2.engine)
}
func TestRouterGroupBasicHandle(t *testing.T) {
@@ -44,10 +44,10 @@ func TestRouterGroupBasicHandle(t *testing.T) {
func performRequestInGroup(t *testing.T, method string) {
router := New()
v1 := router.Group("v1", func(c *Context) {})
assert.Equal(t, v1.BasePath(), "/v1")
assert.Equal(t, "/v1", v1.BasePath())
login := v1.Group("/login/", func(c *Context) {}, func(c *Context) {})
assert.Equal(t, login.BasePath(), "/v1/login/")
assert.Equal(t, "/v1/login/", login.BasePath())
handler := func(c *Context) {
c.String(400, "the method was %s and index %d", c.Request.Method, c.index)
@@ -80,12 +80,12 @@ func performRequestInGroup(t *testing.T, method string) {
}
w := performRequest(router, method, "/v1/login/test")
assert.Equal(t, w.Code, 400)
assert.Equal(t, w.Body.String(), "the method was "+method+" and index 3")
assert.Equal(t, 400, w.Code)
assert.Equal(t, "the method was "+method+" and index 3", w.Body.String())
w = performRequest(router, method, "/v1/test")
assert.Equal(t, w.Code, 400)
assert.Equal(t, w.Body.String(), "the method was "+method+" and index 1")
assert.Equal(t, 400, w.Code)
assert.Equal(t, "the method was "+method+" and index 1", w.Body.String())
}
func TestRouterGroupInvalidStatic(t *testing.T) {