| 1 | package testutilscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/ |
| 2 | |
| 3 | import ( |
| 4 | "errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/" |
| 5 | "ioscip-go gomod github.com/golang/go/src go1.25.0 io/" |
| 6 | ) |
| 7 | |
| 8 | type ErrReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/ErrReader# struct { |
| 9 | errscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/ErrReader#err. error |
| 10 | } |
| 11 | |
| 12 | // Read() always returns the given error, akin to the ErrReader type from the |
| 13 | // "testing/iotest" package but with a complete io.ReadSeekCloser interface. |
| 14 | func (r *ErrReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/ErrReader#) Readscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/ErrReader#Read().(p []byte) (int, error) { |
| 15 | return 0, r.errscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/ErrReader#err. |
| 16 | } |
| 17 | |
| 18 | // Seek() is simply a no-op to complete the io.ReadSeekCloser interface. |
| 19 | func (r *ErrReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/ErrReader#) Seekscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/ErrReader#Seek().(offset int64, whence int) (int64, error) { |
| 20 | return 0, nil |
| 21 | } |
| 22 | |
| 23 | // Close() is simply a no-op to complete the io.ReadSeekCloser interface. |
| 24 | func (r *ErrReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/ErrReader#) Closescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/ErrReader#Close().() error { |
| 25 | return nil |
| 26 | } |
| 27 | |
| 28 | func NewErrReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/NewErrReader().(err error) *ErrReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/ErrReader# { |
| 29 | return &ErrReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/ErrReader#{err} |
| 30 | } |
| 31 | |
| 32 | type EagerEOFByteReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/EagerEOFByteReader# struct { |
| 33 | bscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/EagerEOFByteReader#b. []byte |
| 34 | iscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/EagerEOFByteReader#i. int |
| 35 | } |
| 36 | |
| 37 | // Read() always returns io.EOF as early as possible, so it will |
| 38 | // return (n>0,io.EOF) instead of (n>0,nil) followed by (0,io.EOF). |
| 39 | func (r *EagerEOFByteReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/EagerEOFByteReader#) Readscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/EagerEOFByteReader#Read().(p []byte) (n int, err error) { |
| 40 | n = copy(p, r.bscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/EagerEOFByteReader#b.[r.iscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/EagerEOFByteReader#i.:]) |
| 41 | r.iscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/EagerEOFByteReader#i. += n |
| 42 | |
| 43 | if r.iscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/EagerEOFByteReader#i. == len(r.bscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/EagerEOFByteReader#b.) { |
| 44 | err = ioscip-go gomod github.com/golang/go/src go1.25.0 io/.EOFscip-go gomod github.com/golang/go/src go1.25.0 io/EOF. |
| 45 | } |
| 46 | return |
| 47 | } |
| 48 | |
| 49 | // Seek() could mirror the implementation of the Seek() method |
| 50 | // of bytes.Reader. However, at present we do not need this method |
| 51 | // to be functional for any tests, so we can just stub it out instead. |
| 52 | func (r *EagerEOFByteReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/EagerEOFByteReader#) Seekscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/EagerEOFByteReader#Seek().(offset int64, whence int) (int64, error) { |
| 53 | return 0, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().("not implemented") |
| 54 | } |
| 55 | |
| 56 | func (r *EagerEOFByteReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/EagerEOFByteReader#) Closescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/EagerEOFByteReader#Close().() error { |
| 57 | return nil |
| 58 | } |
| 59 | |
| 60 | func NewEagerEOFByteReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/NewEagerEOFByteReader().(b []byte) *EagerEOFByteReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/EagerEOFByteReader# { |
| 61 | return &EagerEOFByteReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/EagerEOFByteReader#{bscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/EagerEOFByteReader#b.: b} |
| 62 | } |
| 63 | |
| 64 | type DeferredEOFByteReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/DeferredEOFByteReader# struct { |
| 65 | bscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/DeferredEOFByteReader#b. []byte |
| 66 | iscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/DeferredEOFByteReader#i. int |
| 67 | atEOFscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/DeferredEOFByteReader#atEOF. bool |
| 68 | } |
| 69 | |
| 70 | // Read() always returns io.EOF as late as possible, so it will |
| 71 | // return (n>0,nil) followed by (0,io.EOF) instead of (n>0,io.EOF). |
| 72 | func (r *DeferredEOFByteReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/DeferredEOFByteReader#) Readscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/DeferredEOFByteReader#Read().(p []byte) (n int, err error) { |
| 73 | n = copy(p, r.bscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/DeferredEOFByteReader#b.[r.iscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/DeferredEOFByteReader#i.:]) |
| 74 | r.iscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/DeferredEOFByteReader#i. += n |
| 75 | |
| 76 | if r.iscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/DeferredEOFByteReader#i. == len(r.bscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/DeferredEOFByteReader#b.) { |
| 77 | if r.atEOFscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/DeferredEOFByteReader#atEOF. { |
| 78 | err = ioscip-go gomod github.com/golang/go/src go1.25.0 io/.EOFscip-go gomod github.com/golang/go/src go1.25.0 io/EOF. |
| 79 | } else { |
| 80 | r.atEOFscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/DeferredEOFByteReader#atEOF. = true |
| 81 | } |
| 82 | } |
| 83 | return |
| 84 | } |
| 85 | |
| 86 | func NewDeferredEOFByteReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/NewDeferredEOFByteReader().(b []byte) *DeferredEOFByteReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/DeferredEOFByteReader# { |
| 87 | return &DeferredEOFByteReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/DeferredEOFByteReader#{bscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/internal/testutil`/DeferredEOFByteReader#b.: b} |
| 88 | } |