MCPcopy Create free account
hub / github.com/unrolled/render / BenchmarkHTML

Function BenchmarkHTML

render_test.go:77–93  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

75}
76
77func BenchmarkHTML(b *testing.B) {
78 render := New(Options{
79 Directory: "testdata/basic",
80 })
81
82 h := http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
83 _ = render.HTML(w, http.StatusOK, "hello", "gophers")
84 })
85 req, _ := http.NewRequestWithContext(ctx, http.MethodGet, "/foo", nil)
86
87 b.ResetTimer()
88 b.RunParallel(func(pb *testing.PB) {
89 for pb.Next() {
90 h.ServeHTTP(httptest.NewRecorder(), req)
91 }
92 })
93}
94
95// Test Helpers.
96func expect(t *testing.T, a interface{}, b interface{}) {

Callers

nothing calls this directly

Calls 2

NewFunction · 0.85
HTMLMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…