fix test and build
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Javier Provecho Fernandez · committed by Javier Provecho Fernandez · parent 9e930b9 · Browse files · 3 files·+11 added−9 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+11 added−9 removed
- other:+11 added−9 removed
Provenance
- Commit
3c3526f- Tree
4859750- Author
Javier Provecho Fernandez <javiertitan@gmail.com>- Committer
Javier Provecho Fernandez <javiertitan@gmail.com>- Parent
9e930b9
3 files changed+11 added−9 removed
modified:benchmarks_test.go+2 added-1 removed
1 unmodified line2 3 import (4 "html/template"5 "net/http"6+ "os"7 "testing"8 )9 10 func BenchmarkOneRoute(B *testing.B) {25 unmodified lines36 runRequest(B, router, "GET", "/ping")37 }38 39 func Benchmark5Params(B *testing.B) {39- DefaultWriter = newMockWriter()40+ DefaultWriter = os.Stdout41 router := New()42 router.Use(func(c *Context) {})43 router.GET("/param/:param1/:params2/:param3/:param4/:param5", func(c *Context) {})44 runRequest(B, router, "GET", "/param/path/to/parameter/john/12345")114 unmodified linesmodified:gin_test.go+5 added-5 removed
215 unmodified lines216 assert.Len(t, list, 7)217 assertRoutePresent(t, list, RouteInfo{218 Method: "GET",219 Path: "/favicon.ico",220- Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handler_test1$",220+ Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handlerTest1$",221 })222 assertRoutePresent(t, list, RouteInfo{223 Method: "GET",224 Path: "/",225- Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handler_test1$",225+ Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handlerTest1$",226 })227 assertRoutePresent(t, list, RouteInfo{228 Method: "GET",229 Path: "/users/",230- Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handler_test2$",230+ Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handlerTest2$",231 })232 assertRoutePresent(t, list, RouteInfo{233 Method: "GET",234 Path: "/users/:id",235- Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handler_test1$",235+ Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handlerTest1$",236 })237 assertRoutePresent(t, list, RouteInfo{238 Method: "POST",239 Path: "/users/:id",240- Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handler_test2$",240+ Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handlerTest2$",241 })242 }243 244 func assertRoutePresent(t *testing.T, gotRoutes RoutesInfo, wantRoute RouteInfo) {11 unmodified linesmodified:githubapi_test.go+4 added-3 removed
8 unmodified lines9 "fmt"10 "math/rand"11 "net/http"12 "net/http/httptest"13+ "os"14 "testing"15 16 "github.com/stretchr/testify/assert"17 )280 unmodified lines298 }299 }300 301 func TestGithubAPI(t *testing.T) {301- DefaultWriter = newMockWriter()302+ DefaultWriter = os.Stdout303 router := Default()304 githubConfigRouter(router)305 306 for _, route := range githubAPI {50 unmodified lines357 runRequest(b, router, "GET", "/legacy/issues/search/:owner/:repository/:state/:keyword")358 }359 360 func BenchmarkParallelGithub(b *testing.B) {360- DefaultWriter = newMockWriter()361+ DefaultWriter = os.Stdout362 router := New()363 githubConfigRouter(router)364 365 req, _ := http.NewRequest("POST", "/repos/manucorporat/sse/git/blobs", nil)7 unmodified lines373 })374 }375 376 func BenchmarkParallelGithubDefault(b *testing.B) {376- DefaultWriter = newMockWriter()377+ DefaultWriter = os.Stdout378 router := Default()379 githubConfigRouter(router)380 381 req, _ := http.NewRequest("POST", "/repos/manucorporat/sse/git/blobs", nil)9 unmodified lines