gigaparsec/test/readerat.go

18 lines
359 B
Go
Raw Normal View History

2024-09-13 16:38:47 +00:00
// Package test contains helpers for testing parsers.
package test
import "io"
type errReaderAt struct {
err error
}
func (r errReaderAt) ReadAt([]byte, int64) (int, error) {
return 0, r.err
}
// ErrReaderAt returns an [io.ReaderAt] with a ReadAt method that always returns err.
func ErrReaderAt(err error) io.ReaderAt {
return errReaderAt{err: err}
}