diff options
| author | demo <demo@antix1> | 2026-05-10 11:57:56 -0400 |
|---|---|---|
| committer | demo <demo@antix1> | 2026-05-10 11:57:56 -0400 |
| commit | 2735a0388e96fd4d09201ae5451e1a972ef2130a (patch) | |
| tree | 799c4275d0622deb5f4bddd282726c4a4e7af042 /internal/links/find_test.go | |
| parent | d4d5f28c889aca0654b52b8af5960ac274af828e (diff) | |
feat: implement find for finding links
Diffstat (limited to 'internal/links/find_test.go')
| -rw-r--r-- | internal/links/find_test.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/internal/links/find_test.go b/internal/links/find_test.go new file mode 100644 index 0000000..a4c952e --- /dev/null +++ b/internal/links/find_test.go @@ -0,0 +1,34 @@ +package links + +import ( + "strings" + "testing" +) + +const ( + ex1 = ` +<html> + <head> + <title>Ex 1</title> + <head> + <body> + <a href="https://example.com/">Example Page</a> + <a href="/posts">Posts</a> + </body> +</html> +` +) + +func TestFindCountHrefs(t *testing.T) { + r := strings.NewReader(ex1) + hrefs, err := find(r) + if err != nil { + t.Error(err) + } + + const expectedLen = 2 + + if actualLen := len(hrefs); actualLen != expectedLen { + t.Errorf("got %d, want %d", actualLen, expectedLen) + } +} |
