(b *testing.B)
| 34 | var testUser = user{ID: 1, Name: "Jon Snow"} |
| 35 | |
| 36 | func BenchmarkAllocJSONP(b *testing.B) { |
| 37 | e := New() |
| 38 | e.Logger = slog.New(slog.DiscardHandler) |
| 39 | req := httptest.NewRequest(http.MethodPost, "/", strings.NewReader(userJSON)) |
| 40 | rec := httptest.NewRecorder() |
| 41 | c := e.NewContext(req, rec) |
| 42 | |
| 43 | b.ResetTimer() |
| 44 | b.ReportAllocs() |
| 45 | |
| 46 | for i := 0; i < b.N; i++ { |
| 47 | c.JSONP(http.StatusOK, "callback", testUser) |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | func BenchmarkAllocJSON(b *testing.B) { |
| 52 | e := New() |
nothing calls this directly
no test coverage detected
searching dependent graphs…