(t *testing.T)
| 582 | } |
| 583 | |
| 584 | func TestRouterServeFiles(t *testing.T) { |
| 585 | router := New() |
| 586 | mfs := &mockFileSystem{} |
| 587 | |
| 588 | recv := catchPanic(func() { |
| 589 | router.ServeFiles("/noFilepath", mfs) |
| 590 | }) |
| 591 | if recv == nil { |
| 592 | t.Fatal("registering path not ending with '*filepath' did not panic") |
| 593 | } |
| 594 | |
| 595 | router.ServeFiles("/*filepath", mfs) |
| 596 | w := new(mockResponseWriter) |
| 597 | r, _ := http.NewRequest(http.MethodGet, "/favicon.ico", nil) |
| 598 | router.ServeHTTP(w, r) |
| 599 | if !mfs.opened { |
| 600 | t.Error("serving file failed") |
| 601 | } |
| 602 | } |
nothing calls this directly
no test coverage detected