(t *testing.T)
| 283 | } |
| 284 | |
| 285 | func TestMiddleware(t *testing.T) { |
| 286 | m := New() |
| 287 | m.AddFunc("text/html", func(m *M, w io.Writer, r io.Reader, _ map[string]string) error { |
| 288 | _, err := io.Copy(w, r) |
| 289 | return err |
| 290 | }) |
| 291 | |
| 292 | b := &bytes.Buffer{} |
| 293 | w := &testResponseWriter{b, http.Header{}} |
| 294 | r := &http.Request{RequestURI: "/index.html"} |
| 295 | m.Middleware(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 296 | _, _ = w.Write([]byte("test")) |
| 297 | })).ServeHTTP(w, r) |
| 298 | test.String(t, b.String(), "test", "equal input after dummy minify middleware") |
| 299 | } |
| 300 | |
| 301 | func TestHelperProcess(*testing.T) { |
| 302 | if os.Getenv("GO_WANT_HELPER_PROCESS") != "1" { |
nothing calls this directly
no test coverage detected
searching dependent graphs…