1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-01 04:00:18 +00:00

beego: router change to method Tree

This commit is contained in:
astaxie
2014-06-09 10:11:37 +08:00
parent e00eab7f49
commit 6c8a7f1382
5 changed files with 179 additions and 43 deletions

View File

@ -291,6 +291,17 @@ func (a *AdminController) Get() {
a.Ctx.WriteString("hello")
}
func TestRouterFunc(t *testing.T) {
mux := NewControllerRegistor()
mux.Get("/action", beegoFilterFunc)
mux.Post("/action", beegoFilterFunc)
rw, r := testRequest("GET", "/action")
mux.ServeHTTP(rw, r)
if rw.Body.String() != "hello" {
t.Errorf("TestRouterFunc can't run")
}
}
func BenchmarkFunc(b *testing.B) {
mux := NewControllerRegistor()
mux.Get("/action", beegoFilterFunc)