Closed komuw closed 2 years ago
This will be similar to the same func like;
https://pkg.go.dev/github.com/go-quicktest/qt#StringContains
I agree that it'd be nice to have something for this, but I'd really prefer not to have separate versions for string
and []byte
. Maybe rename Contains
to SliceContains
and make the new Contains
accept either string
or []byte
arguments?
that sounds like a good plan.
Added Subsequence
in v0.4.0, which should address this for any type whose underlying type is string
or []byte
.
Also, thanks for the really thoughtful issues you're filing @komuw 😍
I find myself wanting to use
attest.Contains
but then I remember that what I have is a string and not a slice.So I end up doing;
attest.True(t, strings.Contains("some-str", "some-other"))
https://github.com/komuw/ong/blob/2a6145e85fc3227def1173610fe554bc54096270/log/log_test.go#L143-L144