go test -v -run=^$ -bench=Benchmark_Ctx_Get_Location_From_Route -benchmem -count=4
(b *testing.B)
| 8103 | |
| 8104 | // go test -v -run=^$ -bench=Benchmark_Ctx_Get_Location_From_Route -benchmem -count=4 |
| 8105 | func Benchmark_Ctx_Get_Location_From_Route(b *testing.B) { |
| 8106 | app := New() |
| 8107 | c := app.AcquireCtx(&fasthttp.RequestCtx{}).(*DefaultCtx) //nolint:errcheck,forcetypeassert // not needed |
| 8108 | |
| 8109 | app.Get("/user/:name", func(c Ctx) error { |
| 8110 | return c.SendString(c.Params("name")) |
| 8111 | }).Name("User") |
| 8112 | |
| 8113 | var err error |
| 8114 | var location string |
| 8115 | for b.Loop() { |
| 8116 | route := app.GetRoute("User") |
| 8117 | location, err = c.getLocationFromRoute(&route, Map{"name": "fiber"}) |
| 8118 | } |
| 8119 | |
| 8120 | require.Equal(b, "/user/fiber", location) |
| 8121 | require.NoError(b, err) |
| 8122 | } |
| 8123 | |
| 8124 | // go test -run Test_Ctx_Get_Location_From_Route_name |
| 8125 | func Test_Ctx_Get_Location_From_Route_name(t *testing.T) { |
nothing calls this directly
no test coverage detected