Improve MatchSlice test output
This commit is contained in:
parent
82ade62274
commit
e6debbd7dc
@ -48,8 +48,8 @@ func TestSlice(t *testing.T) {
|
||||
}))
|
||||
t.Run("fails at end of input", rapid.MakeCheck(func(t *rapid.T) {
|
||||
s := rapid.SliceOfN(rapid.Byte(), 1, -1).Draw(t, "s")
|
||||
inputLen := rapid.IntRange(0, len(s)-1).Draw(t, "inputLen")
|
||||
input := s[:inputLen]
|
||||
input := rapid.Map(rapid.IntRange(0, len(s)-1),
|
||||
func(n int) []byte { return s[:n] }).Draw(t, "inputLen")
|
||||
assertParseFails(t, input, gigaparsec.MatchSlice(s))
|
||||
}))
|
||||
t.Run("fails when read fails", rapid.MakeCheck(func(t *rapid.T) {
|
||||
@ -63,8 +63,8 @@ func TestSlice(t *testing.T) {
|
||||
}))
|
||||
t.Run("succeeds when contents match", rapid.MakeCheck(func(t *rapid.T) {
|
||||
input := rapid.SliceOfN(rapid.Byte(), 1, -1).Draw(t, "input")
|
||||
sLen := rapid.IntRange(0, len(input)).Draw(t, "sLen")
|
||||
s := input[:sLen]
|
||||
s := rapid.Map(rapid.IntRange(0, len(input)),
|
||||
func(n int) []byte { return input[:n] }).Draw(t, "s")
|
||||
start := gigaparsec.MakeState(bytes.NewReader(input))
|
||||
|
||||
result, err := gigaparsec.MatchSlice(s)(start)
|
||||
|
Loading…
Reference in New Issue
Block a user