Added MatchString

This commit is contained in:
2024-09-24 11:53:32 -06:00
parent 51f3532d64
commit 447058020f
3 changed files with 68 additions and 3 deletions

View File

@ -6,7 +6,9 @@ package test
import (
"io"
"git.codemonkeysoftware.net/b/gigaparsec"
"git.codemonkeysoftware.net/b/gigaparsec/cursor"
"github.com/shoenig/test"
)
type errReaderAt struct {
@ -44,3 +46,7 @@ func (c errCursor[T]) Pos() uint64 {
func ErrCursor[T any](err error) cursor.Cursor[T] {
return errCursor[T]{err: err}
}
func StateIsAt[Input any](t test.T, s gigaparsec.State[Input], pos uint64) {
test.EqOp(t, pos, s.Pos(), test.Sprintf("expected parser state to be at position %d, got %d", pos, s.Pos()))
}