Test Regexp failure message

This commit is contained in:
Brandon Dyck 2024-10-16 13:50:14 -06:00
parent c22246b7de
commit f3a37f5fb6

View File

@ -58,7 +58,13 @@ func TestRegexp(t *testing.T) {
test.ErrorIs(t, err, expectedErr) test.ErrorIs(t, err, expectedErr)
test.False(t, succeeded) test.False(t, succeeded)
}) })
t.Run("returns a useful Got value", Todo) t.Run("returns a useful Got value", func(t *testing.T) {
p := pbytes.Regexp("hello")
result, err := p(gigaparsec.MakeState(strings.NewReader("hellaparsec")))
must.NoError(t, err)
test.StrContains(t, result.Message().Got(), "hella")
})
} }
func TestRuneReader(t *testing.T) { func TestRuneReader(t *testing.T) {