(t *testing.T)
| 563 | } |
| 564 | |
| 565 | func TestEchoStaticRedirectIndex(t *testing.T) { |
| 566 | e := New() |
| 567 | |
| 568 | // HandlerFunc |
| 569 | ri := e.Static("/static", "_fixture") |
| 570 | assert.Equal(t, http.MethodGet, ri.Method) |
| 571 | assert.Equal(t, "/static*", ri.Path) |
| 572 | assert.Equal(t, "GET:/static*", ri.Name) |
| 573 | assert.Equal(t, []string{"*"}, ri.Parameters) |
| 574 | |
| 575 | ctx, cancel := stdContext.WithTimeout(stdContext.Background(), 200*time.Millisecond) |
| 576 | defer cancel() |
| 577 | addr, err := startOnRandomPort(ctx, e) |
| 578 | if err != nil { |
| 579 | assert.Fail(t, err.Error()) |
| 580 | } |
| 581 | |
| 582 | code, body, err := doGet(fmt.Sprintf("http://%v/static", addr)) |
| 583 | assert.NoError(t, err) |
| 584 | assert.True(t, strings.HasPrefix(body, "<!doctype html>")) |
| 585 | assert.Equal(t, http.StatusOK, code) |
| 586 | } |
| 587 | |
| 588 | func TestEchoFile(t *testing.T) { |
| 589 | var testCases = []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…