diff options
author | Nick White <git@njw.name> | 2022-11-22 16:14:25 +0000 |
---|---|---|
committer | Nick White <git@njw.name> | 2022-11-22 16:14:25 +0000 |
commit | 59f87fbcbcc4d6c5ac165d6053c1a3734f48e810 (patch) | |
tree | 91ece3b4799d6c3a0f6ee36a7f55644ce7888b8c /cmd/rescribe/gbook_test.go | |
parent | fa1e5fa6d5468a25195463426921607bcc7768bc (diff) |
rescribe: add gbook fuzzer test and fix some bugs it found!
Diffstat (limited to 'cmd/rescribe/gbook_test.go')
-rw-r--r-- | cmd/rescribe/gbook_test.go | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/cmd/rescribe/gbook_test.go b/cmd/rescribe/gbook_test.go index 56b4b40..f7df595 100644 --- a/cmd/rescribe/gbook_test.go +++ b/cmd/rescribe/gbook_test.go @@ -8,7 +8,7 @@ import ( "testing" ) -func Test_getBookIdFromUrl(t *testing.T) { +func TestGetBookIdFromUrl(t *testing.T) { cases := []struct { url string id string @@ -29,3 +29,18 @@ func Test_getBookIdFromUrl(t *testing.T) { }) } } + +func FuzzGetBookIdFromUrl(f *testing.F) { + cases := []string { + "https://books.google.it/books?id=QjQepCuN8JYC", + "https://www.google.it/books/edition/_/VJbr-Oe2au0C", + } + + for _, c := range cases { + f.Add(c) + } + + f.Fuzz(func(t *testing.T, url string) { + getBookIdFromUrl(url) + }) +} |