Documentation
¶
Index ¶
- type FileSystem
- type MockFile
- type MockFileSystem
- func (mfs *MockFileSystem) AddDir(path string)
- func (mfs *MockFileSystem) AddFile(path string, content []byte)
- func (mfs *MockFileSystem) Exists(path string) bool
- func (mfs *MockFileSystem) GetFiles() map[string]*MockFile
- func (mfs *MockFileSystem) Getwd() (string, error)
- func (mfs *MockFileSystem) Glob(pattern string) ([]string, error)
- func (mfs *MockFileSystem) MkdirAll(path string, perm fs.FileMode) error
- func (mfs *MockFileSystem) PrintTree()
- func (mfs *MockFileSystem) ReadDir(path string) ([]fs.DirEntry, error)
- func (mfs *MockFileSystem) ReadFile(path string) ([]byte, error)
- func (mfs *MockFileSystem) Remove(path string) error
- func (mfs *MockFileSystem) SetCurrentDir(dir string)
- func (mfs *MockFileSystem) Stat(path string) (fs.FileInfo, error)
- func (mfs *MockFileSystem) WalkDir(root string, fn fs.WalkDirFunc) error
- func (mfs *MockFileSystem) WriteFile(path string, data []byte, perm fs.FileMode) error
- type OSFileSystem
- func (osfs *OSFileSystem) Exists(path string) bool
- func (osfs *OSFileSystem) Getwd() (string, error)
- func (osfs *OSFileSystem) Glob(pattern string) ([]string, error)
- func (osfs *OSFileSystem) MkdirAll(path string, perm fs.FileMode) error
- func (osfs *OSFileSystem) ReadDir(path string) ([]fs.DirEntry, error)
- func (osfs *OSFileSystem) ReadFile(path string) ([]byte, error)
- func (osfs *OSFileSystem) Remove(path string) error
- func (osfs *OSFileSystem) Stat(path string) (fs.FileInfo, error)
- func (osfs *OSFileSystem) WalkDir(root string, fn fs.WalkDirFunc) error
- func (osfs *OSFileSystem) WriteFile(path string, data []byte, perm fs.FileMode) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileSystem ¶
type FileSystem interface {
// File operations
ReadFile(path string) ([]byte, error)
WriteFile(path string, data []byte, perm fs.FileMode) error
Remove(path string) error
// Directory operations
ReadDir(path string) ([]fs.DirEntry, error)
MkdirAll(path string, perm fs.FileMode) error
// Path operations
Stat(path string) (fs.FileInfo, error)
Exists(path string) bool
Getwd() (string, error)
// File walking
WalkDir(root string, fn fs.WalkDirFunc) error
// Glob patterns
Glob(pattern string) ([]string, error)
}
FileSystem provides an abstraction over file operations for testability
type MockFileSystem ¶
type MockFileSystem struct {
// contains filtered or unexported fields
}
MockFileSystem provides in-memory filesystem for testing
func NewMockFileSystem ¶
func NewMockFileSystem() *MockFileSystem
NewMockFileSystem creates a new MockFileSystem
func (*MockFileSystem) AddDir ¶
func (mfs *MockFileSystem) AddDir(path string)
AddDir adds a directory to the mock filesystem
func (*MockFileSystem) AddFile ¶
func (mfs *MockFileSystem) AddFile(path string, content []byte)
AddFile adds a file to the mock filesystem
func (*MockFileSystem) Exists ¶
func (mfs *MockFileSystem) Exists(path string) bool
func (*MockFileSystem) GetFiles ¶
func (mfs *MockFileSystem) GetFiles() map[string]*MockFile
GetFiles returns all files in the mock filesystem (for debugging)
func (*MockFileSystem) Getwd ¶
func (mfs *MockFileSystem) Getwd() (string, error)
func (*MockFileSystem) MkdirAll ¶
func (mfs *MockFileSystem) MkdirAll(path string, perm fs.FileMode) error
func (*MockFileSystem) PrintTree ¶
func (mfs *MockFileSystem) PrintTree()
PrintTree prints the filesystem tree (for debugging)
func (*MockFileSystem) ReadDir ¶
func (mfs *MockFileSystem) ReadDir(path string) ([]fs.DirEntry, error)
func (*MockFileSystem) Remove ¶
func (mfs *MockFileSystem) Remove(path string) error
func (*MockFileSystem) SetCurrentDir ¶
func (mfs *MockFileSystem) SetCurrentDir(dir string)
SetCurrentDir sets the current working directory for the mock
func (*MockFileSystem) WalkDir ¶
func (mfs *MockFileSystem) WalkDir(root string, fn fs.WalkDirFunc) error
type OSFileSystem ¶
type OSFileSystem struct{}
OSFileSystem implements FileSystem using real OS operations
func NewOSFileSystem ¶
func NewOSFileSystem() *OSFileSystem
NewOSFileSystem creates a new OSFileSystem
func (*OSFileSystem) Exists ¶
func (osfs *OSFileSystem) Exists(path string) bool
func (*OSFileSystem) Getwd ¶
func (osfs *OSFileSystem) Getwd() (string, error)
func (*OSFileSystem) MkdirAll ¶
func (osfs *OSFileSystem) MkdirAll(path string, perm fs.FileMode) error
func (*OSFileSystem) ReadDir ¶
func (osfs *OSFileSystem) ReadDir(path string) ([]fs.DirEntry, error)
func (*OSFileSystem) Remove ¶
func (osfs *OSFileSystem) Remove(path string) error
func (*OSFileSystem) WalkDir ¶
func (osfs *OSFileSystem) WalkDir(root string, fn fs.WalkDirFunc) error
Click to show internal directories.
Click to hide internal directories.