18 lines
359 B
Go
18 lines
359 B
Go
|
// 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}
|
||
|
}
|