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

add AutoRouterWithPrefix

This commit is contained in:
astaxie
2014-01-01 17:57:57 +08:00
parent 803d91c077
commit d57557dc55
4 changed files with 75 additions and 4 deletions

View File

@ -198,3 +198,15 @@ func TestPrepare(t *testing.T) {
t.Errorf(w.Body.String() + "user define func can't run")
}
}
func TestAutoPrefix(t *testing.T) {
r, _ := http.NewRequest("GET", "/admin/test/list", nil)
w := httptest.NewRecorder()
handler := NewControllerRegistor()
handler.AddAutoPrefix("/admin", &TestController{})
handler.ServeHTTP(w, r)
if w.Body.String() != "i am list" {
t.Errorf("TestAutoPrefix can't run")
}
}