Skip to content

Commit

Permalink
feat(route): move route to dev.route branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Aoi-hosizora committed Jul 31, 2020
1 parent 05ec88f commit 9731083
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 296 deletions.
90 changes: 0 additions & 90 deletions xfiber/route.go

This file was deleted.

30 changes: 0 additions & 30 deletions xfiber/xfiber_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,6 @@ import (
"testing"
)

func TestComposite(t *testing.T) {
app := fiber.New()
app.Get("/:id", Composite("id",
M(func(c *fiber.Ctx) {
log.Println(11, c.Params("id"))
}, func(c *fiber.Ctx) {
log.Println(12, c.Params("id"))
}),
P("a", func(c *fiber.Ctx) {
log.Println(21, c.Params("id"))
}, func(c *fiber.Ctx) {
log.Println(22, c.Params("id"))
c.Next()
}, func(c *fiber.Ctx) {
log.Println(23, c.Params("id"))
}),
P("b", func(c *fiber.Ctx) {
log.Println(31, c.Params("id"))
}, func(c *fiber.Ctx) {
log.Println(32, c.Params("id"))
}),
N(func(c *fiber.Ctx) {
log.Println(41, c.Params("id"))
}),
), func(c *fiber.Ctx) {
log.Println(51, c.Params("id"))
})
_ = app.Listen("1234")
}

func TestDumpRequest(t *testing.T) {
app := fiber.New()
app.Get("a", func(c *fiber.Ctx) {
Expand Down
90 changes: 0 additions & 90 deletions xgin/route.go

This file was deleted.

86 changes: 0 additions & 86 deletions xgin/xgin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,89 +15,3 @@ func TestDumpRequest(t *testing.T) {
})
_ = app.Run(":1234")
}

func handle(c *gin.Context) {
log.Println(c.Request.URL.Path, "!", c.Param("id"))
}

func handle2(c *gin.Context) {
log.Println(c.Request.URL.Path, "!!", c.Param("id"))
}

func handle3(c *gin.Context) {
log.Println(c.Request.URL.Path, "!!!", c.Param("id"))
}

func handle4(c *gin.Context) {
log.Println(c.Request.URL.Path, "!!!!", c.Param("id"))
}

func handle5(c *gin.Context) {
log.Println(c.Request.URL.Path, "!!!!!", c.Param("id"))
}

func handle6(c *gin.Context) {
log.Println(c.Request.URL.Path, "!!!!!!", c.Param("id"))
}

func TestComposite(t *testing.T) {
gin.SetMode(gin.TestMode)
engine := gin.New()
testGroup := engine.Group("/test")
{
testGroup.GET("", handle)
testGroup.GET("/:id/:id2", Composite("id",
M(handle), // /?/?
P("test", handle2), // /test/?
P("test2", Composite("id2",
M(handle2), // /test2/?
P("test", handle3), // /test2/test
P("test2", handle3), // /test2/test2
N(handle4), // /test2/0
)),
N(handle4, // /0/?
Composite("id2",
M(handle5), // /0/?
P("test", handle6), // /0/test
),
),
))
}
ctxGroup := engine.Group("/ctx")
{
ctxGroup.GET("", func(c *gin.Context) {
log.Println(1)
}, func(c *gin.Context) {
log.Println(2)
})
ctxGroup.GET("/:id", Composite("id",
M(func(c *gin.Context) {
log.Println(11)
}, func(c *gin.Context) {
log.Println(12)
c.Abort()
}),
P("test", func(c *gin.Context) {
log.Println(21)
}, func(c *gin.Context) {
log.Println(22)
}),
P("test2", func(c *gin.Context) {
log.Println(31)
}, func(c *gin.Context) {
log.Println(32)
c.Abort()
}, func(c *gin.Context) {
log.Println(33)
c.Abort()
}),
N(func(c *gin.Context) {
log.Println(41)
c.Abort()
}, func(c *gin.Context) {
log.Println(42)
}),
))
}
_ = engine.Run(":1234")
}

0 comments on commit 9731083

Please sign in to comment.