(t *testing.T)
| 1415 | } |
| 1416 | |
| 1417 | func TestContextRenderFile(t *testing.T) { |
| 1418 | w := httptest.NewRecorder() |
| 1419 | c, _ := CreateTestContext(w) |
| 1420 | |
| 1421 | c.Request, _ = http.NewRequest(http.MethodGet, "/", nil) |
| 1422 | c.File("./gin.go") |
| 1423 | |
| 1424 | assert.Equal(t, http.StatusOK, w.Code) |
| 1425 | assert.Contains(t, w.Body.String(), "func New(opts ...OptionFunc) *Engine {") |
| 1426 | // Content-Type='text/plain; charset=utf-8' when go version <= 1.16, |
| 1427 | // else, Content-Type='text/x-go; charset=utf-8' |
| 1428 | assert.NotEmpty(t, w.Header().Get("Content-Type")) |
| 1429 | } |
| 1430 | |
| 1431 | func TestContextRenderFileFromFS(t *testing.T) { |
| 1432 | w := httptest.NewRecorder() |
nothing calls this directly
no test coverage detected