Test ReaderAtCursor with failing ReaderAt
This commit is contained in:
@ -2,12 +2,12 @@ package gigaparsec_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"git.codemonkeysoftware.net/b/gigaparsec"
|
||||
"git.codemonkeysoftware.net/b/gigaparsec/cursor"
|
||||
ptest "git.codemonkeysoftware.net/b/gigaparsec/test"
|
||||
"git.codemonkeysoftware.net/b/gigaparsec/test/generator"
|
||||
"github.com/shoenig/test"
|
||||
"github.com/shoenig/test/must"
|
||||
"pgregory.net/rapid"
|
||||
@ -52,7 +52,7 @@ func TestSlice(t *testing.T) {
|
||||
assertParseFails(t, input, gigaparsec.Slice(s))
|
||||
}))
|
||||
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")
|
||||
expectedErr := generator.Error().Draw(t, "expectedErr")
|
||||
c := ptest.ErrCursor[byte](expectedErr)
|
||||
s := rapid.SliceOfN(rapid.Byte(), 0, 100).Draw(t, "s")
|
||||
result, err := gigaparsec.Slice(s)(gigaparsec.MakeState(c))
|
||||
|
Reference in New Issue
Block a user