Another test and pithy README example

This commit is contained in:
Justin Hawkins 2025-03-27 19:58:21 +10:30
parent b7605c42b4
commit 51e9386e6b
2 changed files with 22 additions and 0 deletions

View File

@ -1 +1,15 @@
[![Go Reference](https://pkg.go.dev/badge/github.com/tardisx/haiku-detector.svg)](https://pkg.go.dev/github.com/tardisx/haiku-detector)
import "github.com/tardisx/haiku-detector"
haiku := haiku.Find("haiku can be found wherever you are looking with help of some code")
if len(haiku) > 0 {
println(haiku[0].String())
}
// haiku can be found
// wherever you are looking
// with help of some code

View File

@ -117,6 +117,14 @@ Memory held tight, swept away in quiet dusk, Go frees what I leave.`
another waits in silence,
they meet, work is done`, out[2].String())
}
h := Find("haiku can be found wherever you are looking with help of some code")
if assert.Len(t, h, 1) {
assert.Equal(t, `haiku can be found
wherever you are looking
with help of some code`, h[0].String())
}
}
func FuzzHaikuFromSentence(f *testing.F) {