Skip to content

Commit

Permalink
debugPrintRoutes() unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Jul 12, 2015
1 parent 6efa062 commit fd5d429
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions debug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ func TestDebugPrintError(t *testing.T) {
assert.Equal(t, w.String(), "[GIN-debug] [ERROR] this is an error\n")
}

func TestDebugPrintRoutes(t *testing.T) {
var w bytes.Buffer
setup(&w)
defer teardown()

debugPrintRoute("GET", "/path/to/route/:param", HandlersChain{func(c *Context) {}, handlerNameTest})
assert.Equal(t, w.String(), "[GIN-debug] GET /path/to/route/:param --> github.com/gin-gonic/gin.handlerNameTest (2 handlers)\n")
}

func setup(w io.Writer) {
SetMode(DebugMode)
log.SetOutput(w)
Expand Down

0 comments on commit fd5d429

Please sign in to comment.