Load HTML from the file given and parse it, checking it against the entries passed in
(t *testing.T, name string, base string, want []string)
| 390 | |
| 391 | // Load HTML from the file given and parse it, checking it against the entries passed in |
| 392 | func parseHTML(t *testing.T, name string, base string, want []string) { |
| 393 | in, err := os.Open(filepath.Join(testPath, "index_files", name)) |
| 394 | require.NoError(t, err) |
| 395 | defer func() { |
| 396 | require.NoError(t, in.Close()) |
| 397 | }() |
| 398 | if base == "" { |
| 399 | base = "http://example.com/" |
| 400 | } |
| 401 | u, err := url.Parse(base) |
| 402 | require.NoError(t, err) |
| 403 | entries, err := parse(u, in) |
| 404 | require.NoError(t, err) |
| 405 | assert.Equal(t, want, entries) |
| 406 | } |
| 407 | |
| 408 | func TestParseEmpty(t *testing.T) { |
| 409 | parseHTML(t, "empty.html", "", []string(nil)) |
no test coverage detected
searching dependent graphs…