Renamed Result.Succeeded to Status and removed Failed

This commit is contained in:
2024-09-24 13:16:30 -06:00
parent f8bc7582a5
commit 9375b51a70
7 changed files with 114 additions and 113 deletions

View File

@ -33,7 +33,8 @@ func TestSlice(t *testing.T) {
start := gigaparsec.MakeState(cursor.NewSlice(input))
result, err := p(start)
must.NoError(t, err)
test.True(t, result.Failed())
success, _, _ := result.Status()
test.False(t, success)
test.False(t, result.Consumed())
if t.Failed() {
t.FailNow()
@ -58,7 +59,8 @@ func TestSlice(t *testing.T) {
s := rapid.SliceOfN(rapid.Byte(), 0, 100).Draw(t, "s")
result, err := gigaparsec.MatchSlice(s)(gigaparsec.MakeState(c))
test.ErrorIs(t, err, expectedErr)
test.True(t, result.Failed())
success, _, _ := result.Status()
test.False(t, success)
}))
t.Run("succeeds when contents match", rapid.MakeCheck(func(t *rapid.T) {
input := rapid.SliceOfN(rapid.Byte(), 1, -1).Draw(t, "input")
@ -68,8 +70,8 @@ func TestSlice(t *testing.T) {
result, err := gigaparsec.MatchSlice(s)(start)
must.NoError(t, err)
succeeded, value, next := result.Succeeded()
test.True(t, succeeded)
success, value, next := result.Status()
test.True(t, success)
test.True(t, result.Consumed())
test.SliceEqOp(t, s, value)
test.EqOp(t, uint64(len(s)), next.Pos())