diff options
Diffstat (limited to 'internal/findlinks/findlinks_test.go')
| -rw-r--r-- | internal/findlinks/findlinks_test.go | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/internal/findlinks/findlinks_test.go b/internal/findlinks/findlinks_test.go deleted file mode 100644 index 79fb241..0000000 --- a/internal/findlinks/findlinks_test.go +++ /dev/null @@ -1,51 +0,0 @@ -package findlinks - -import ( - "os" - "testing" - - "github.com/google/go-cmp/cmp" -) - -func findLinksFile(filename string) ([]Link, error) { - f, err := os.Open(filename) - if err != nil { - panic("can't open test file") - } - defer f.Close() - - return FindLinks(f) -} - -func TestFindlinks(t *testing.T) { - type test struct { - filename string - links []Link - } - - tests := []test{ - { - "html/ex1.html", - []Link{ - { - Href: "/other-page", - Text: "A link to another page", - }, - }, - }, - } - - for _, test := range tests { - t.Run(test.filename, func(t *testing.T) { - links, err := findLinksFile(test.filename) - if err != nil { - t.Error(err) - } - - if !cmp.Equal(links, test.links) { - t.Errorf("got %v, want %v", links, test.links) - } - }) - } - -} |
