From e6debbd7dcf8743c93bc01004355fe03bec0570c Mon Sep 17 00:00:00 2001 From: Brandon Dyck Date: Fri, 27 Sep 2024 09:37:35 -0600 Subject: [PATCH] Improve MatchSlice test output --- parser_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/parser_test.go b/parser_test.go index acd9deb..08251e6 100644 --- a/parser_test.go +++ b/parser_test.go @@ -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)