github.com/johnnyeven/libtools@v0.0.0-20191126065708-61829c1adf46/courier/router_test.go (about) 1 package courier 2 3 import ( 4 "context" 5 "testing" 6 7 "github.com/davecgh/go-spew/spew" 8 9 "github.com/johnnyeven/libtools/courier/httpx" 10 ) 11 12 type Group struct { 13 EmptyOperator 14 } 15 16 type Auth struct{} 17 18 func (auth Auth) Output(ctx context.Context) (result interface{}, err error) { 19 return 20 } 21 22 type Get struct { 23 httpx.MethodGet 24 } 25 26 func (get Get) Path() string { 27 return "/id" 28 } 29 30 func (get Get) Output() (result interface{}, err error) { 31 return 32 } 33 34 func TestGroup(t *testing.T) { 35 router := NewRouter(Group{}) 36 router.Register(NewRouter(Auth{})) 37 38 spew.Dump(router) 39 spew.Dump(router.Routes()) 40 }