Skip to content
Myr

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

3 files+11 added−9 removed

modified:benchmarks_test.go+2 added-1 removed
1 unmodified line
23import (4 "html/template"5 "net/http"6 "os"7 "testing"8)910func BenchmarkOneRoute(B *testing.B) {
25 unmodified lines
36 runRequest(B, router, "GET", "/ping")37}3839func 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 lines
modified:gin_test.go+5 added-5 removed
215 unmodified lines
216 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}243244func assertRoutePresent(t *testing.T, gotRoutes RoutesInfo, wantRoute RouteInfo) {
11 unmodified lines
modified:githubapi_test.go+4 added-3 removed
8 unmodified lines
9 "fmt"10 "math/rand"11 "net/http"12 "net/http/httptest"13 "os"14 "testing"1516 "github.com/stretchr/testify/assert"17)
280 unmodified lines
298 }299}300301func TestGithubAPI(t *testing.T) {301 DefaultWriter = newMockWriter()302 DefaultWriter = os.Stdout303 router := Default()304 githubConfigRouter(router)305306 for _, route := range githubAPI {
50 unmodified lines
357 runRequest(b, router, "GET", "/legacy/issues/search/:owner/:repository/:state/:keyword")358}359360func BenchmarkParallelGithub(b *testing.B) {360 DefaultWriter = newMockWriter()361 DefaultWriter = os.Stdout362 router := New()363 githubConfigRouter(router)364365 req, _ := http.NewRequest("POST", "/repos/manucorporat/sse/git/blobs", nil)
7 unmodified lines
373 })374}375376func BenchmarkParallelGithubDefault(b *testing.B) {376 DefaultWriter = newMockWriter()377 DefaultWriter = os.Stdout378 router := Default()379 githubConfigRouter(router)380381 req, _ := http.NewRequest("POST", "/repos/manucorporat/sse/git/blobs", nil)
9 unmodified lines