mocks

package
v1.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package mocks provides shared mock implementations for testing across the application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockFS

type MockFS struct {
	Files      map[string]bool // path -> isDir
	RenameErr  error
	WalkErr    error
	WalkFnErr  error // New field to simulate an error passed to the walk function.
	RenameFrom string
	RenameTo   string
}

MockFS implements the FS interface for testing purposes.

func (*MockFS) Rename

func (m *MockFS) Rename(oldpath, newpath string) error

Rename simulates renaming a file.

func (*MockFS) Stat

func (m *MockFS) Stat(name string) (fs.FileInfo, error)

Stat simulates the Stat operation for our mock file system.

func (*MockFS) WalkDir

func (m *MockFS) WalkDir(root string, fn fs.WalkDirFunc) error

WalkDir simulates walking a directory structure.

type MockFileInfo

type MockFileInfo struct {
	FileName  string
	IsDirBool bool
}

MockFileInfo implements fs.FileInfo for our mock file system.

func (MockFileInfo) IsDir

func (m MockFileInfo) IsDir() bool

IsDir returns true if the entry is a directory.

func (MockFileInfo) ModTime

func (m MockFileInfo) ModTime() time.Time

ModTime returns the modification time.

func (MockFileInfo) Mode

func (m MockFileInfo) Mode() fs.FileMode

Mode returns the file mode.

func (MockFileInfo) Name

func (m MockFileInfo) Name() string

Name returns the name of the file.

func (MockFileInfo) Size

func (m MockFileInfo) Size() int64

Size returns the size of the file.

func (MockFileInfo) Sys

func (m MockFileInfo) Sys() interface{}

Sys returns the underlying data source.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL