diff options
Diffstat (limited to 'internal/links/find_test.go')
| -rw-r--r-- | internal/links/find_test.go | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/internal/links/find_test.go b/internal/links/find_test.go deleted file mode 100644 index e0866a5..0000000 --- a/internal/links/find_test.go +++ /dev/null @@ -1,56 +0,0 @@ -package links - -import ( - "fmt" - "strings" - "testing" -) - -type exampleType struct { - expectedCount int - content string -} - -var examples = []exampleType{ - {2, ` -<html>c - <head> - <title>Ex 1</title> - <head> - <body> - <a href="https://example.com/">Example Page</a> - <a href="/posts">Posts</a> - </body> -</html> -`}, - - {4, `<html> - <head> - <title>Ex 2</title> - <head> - <body> - <a href="https://example.com/">Example Page</a> - <a href="/posts">Posts</a> - <a href="#">A <a href="#">rouge</a> link!</a> - </body> -</html> -`}, -} - -func TestFindCountHrefs(t *testing.T) { - for i, ex := range examples { - name := fmt.Sprintf("Example %d", i+1) - - t.Run(name, func(t *testing.T) { - r := strings.NewReader(ex.content) - hrefs, err := parse(r) - if err != nil { - t.Error(err) - } - - if actualCount := len(hrefs); actualCount != ex.expectedCount { - t.Errorf("got %d, want %d", actualCount, ex.expectedCount) - } - }) - } -} |
