From 3c3526f1f1935955a3e54fd2c0d8468802ee502e Mon Sep 17 00:00:00 2001 From: Javier Provecho Fernandez Date: Fri, 15 Apr 2016 01:35:22 +0200 Subject: [PATCH] fix test and build --- benchmarks_test.go | 3 ++- gin_test.go | 10 +++++----- githubapi_test.go | 7 ++++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/benchmarks_test.go b/benchmarks_test.go index 8a1c91a9..ebe9804c 100644 --- a/benchmarks_test.go +++ b/benchmarks_test.go @@ -3,6 +3,7 @@ package gin import ( "html/template" "net/http" + "os" "testing" ) @@ -36,7 +37,7 @@ func BenchmarkManyHandlers(B *testing.B) { } func Benchmark5Params(B *testing.B) { - DefaultWriter = newMockWriter() + DefaultWriter = os.Stdout router := New() router.Use(func(c *Context) {}) router.GET("/param/:param1/:params2/:param3/:param4/:param5", func(c *Context) {}) diff --git a/gin_test.go b/gin_test.go index eda4ffe1..cc24bc92 100644 --- a/gin_test.go +++ b/gin_test.go @@ -217,27 +217,27 @@ func TestListOfRoutes(t *testing.T) { assertRoutePresent(t, list, RouteInfo{ Method: "GET", Path: "/favicon.ico", - Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handler_test1$", + Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handlerTest1$", }) assertRoutePresent(t, list, RouteInfo{ Method: "GET", Path: "/", - Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handler_test1$", + Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handlerTest1$", }) assertRoutePresent(t, list, RouteInfo{ Method: "GET", Path: "/users/", - Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handler_test2$", + Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handlerTest2$", }) assertRoutePresent(t, list, RouteInfo{ Method: "GET", Path: "/users/:id", - Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handler_test1$", + Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handlerTest1$", }) assertRoutePresent(t, list, RouteInfo{ Method: "POST", Path: "/users/:id", - Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handler_test2$", + Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handlerTest2$", }) } diff --git a/githubapi_test.go b/githubapi_test.go index 75f2de93..a08c264d 100644 --- a/githubapi_test.go +++ b/githubapi_test.go @@ -10,6 +10,7 @@ import ( "math/rand" "net/http" "net/http/httptest" + "os" "testing" "github.com/stretchr/testify/assert" @@ -298,7 +299,7 @@ func githubConfigRouter(router *Engine) { } func TestGithubAPI(t *testing.T) { - DefaultWriter = newMockWriter() + DefaultWriter = os.Stdout router := Default() githubConfigRouter(router) @@ -357,7 +358,7 @@ func BenchmarkGithub(b *testing.B) { } func BenchmarkParallelGithub(b *testing.B) { - DefaultWriter = newMockWriter() + DefaultWriter = os.Stdout router := New() githubConfigRouter(router) @@ -373,7 +374,7 @@ func BenchmarkParallelGithub(b *testing.B) { } func BenchmarkParallelGithubDefault(b *testing.B) { - DefaultWriter = newMockWriter() + DefaultWriter = os.Stdout router := Default() githubConfigRouter(router)