Refine Slice read error test

This commit is contained in:
2024-09-13 11:02:13 -06:00
parent 552b338381
commit 4761259567
2 changed files with 29 additions and 3 deletions

View File

@ -53,8 +53,7 @@ func TestSlice(t *testing.T) {
}))
t.Run("fails when read fails", rapid.MakeCheck(func(t *rapid.T) {
expectedErr := rapid.Map(rapid.StringN(0, 100, -1), errors.New).Draw(t, "err")
r := ptest.ErrReaderAt(expectedErr)
c := cursor.NewReaderAt(r)
c := ptest.ErrCursor[byte](expectedErr)
s := rapid.SliceOfN(rapid.Byte(), 0, 100).Draw(t, "s")
result, err := gigaparsec.Slice(s)(gigaparsec.MakeState(c))
failed, _, _ := result.Failed()