Documentation ¶
Overview ¶
Package fakeobj provides a fake object for testing. such as fake fs.File, fs.FileInfo, fs.DirEntry etc.
Index ¶
- type DirEntry
- type FileInfo
- func (f *FileInfo) Close() error
- func (f *FileInfo) IsDir() bool
- func (f *FileInfo) ModTime() time.Time
- func (f *FileInfo) Mode() fs.FileMode
- func (f *FileInfo) Name() string
- func (f *FileInfo) Read(p []byte) (int, error)
- func (f *FileInfo) Reset() *FileInfo
- func (f *FileInfo) Size() int64
- func (f *FileInfo) Stat() (fs.FileInfo, error)
- func (f *FileInfo) Sys() any
- func (f *FileInfo) WithBody(s string) *FileInfo
- func (f *FileInfo) WithMtime(mt time.Time) *FileInfo
- type IOWriter
- type Reader
- type Writer
- func (w *Writer) Close() error
- func (w *Writer) Flush() error
- func (w *Writer) ResetGet() string
- func (w *Writer) SetErrOnClose() *Writer
- func (w *Writer) SetErrOnFlush() *Writer
- func (w *Writer) SetErrOnSync() *Writer
- func (w *Writer) SetErrOnWrite() *Writer
- func (w *Writer) Sync() error
- func (w *Writer) Write(p []byte) (n int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DirEntry ¶
DirEntry implements the fs.DirEntry
func NewDirEntry ¶
NewDirEntry create a fs.DirEntry
type FileInfo ¶
type FileInfo struct { Dir bool Nam string // basename Mod fs.FileMode Mt time.Time // Path full path Path string Contents string CloseErr error // contains filtered or unexported fields }
FileInfo implements the fs.FileInfo, fs.File
func (*FileInfo) Size ¶
Size returns the length in bytes for regular files; system-dependent for others.
type IOWriter ¶ added in v0.6.12
type IOWriter struct { Buf []byte // ErrOnWrite return error on write, useful for testing ErrOnWrite bool }
IOWriter only implements the io.Writer
type Reader ¶ added in v0.6.12
type Reader struct { byteutil.Buffer // ErrOnRead return error on read, useful for testing ErrOnRead bool }
Reader implements the io.Reader, io.Closer
type Writer ¶
type Writer struct { byteutil.Buffer // ErrOnWrite return error on write, useful for testing ErrOnWrite bool // ErrOnFlush return error on flush, useful for testing ErrOnFlush bool // ErrOnSync return error on flush, useful for testing ErrOnSync bool // ErrOnClose return error on close, useful for testing ErrOnClose bool }
Writer implements the io.Writer, stdio.Flusher, io.Closer.
func (*Writer) SetErrOnSync ¶ added in v0.6.11
SetErrOnSync method
Click to show internal directories.
Click to hide internal directories.