fs

package
v0.1.22 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DirEntry

type DirEntry interface {
	Name() string
	IsDir() bool
	Type() fs.FileMode
	Info() (FileInfo, error)
}

DirEntry mirrors fs.DirEntry to enable mocking.

type FileInfo

type FileInfo interface {
	Name() string
	Size() int64
	Mode() os.FileMode
	ModTime() time.Time
	IsDir() bool
	Sys() any
}

FileInfo mirrors os.FileInfo to enable mocking (mockery has issues with stdlib interfaces).

type FileSystem

type FileSystem interface {
	Getwd() (string, error)
	Stat(path string) (FileInfo, error)
	ReadDir(path string) ([]DirEntry, error)
	WriteFile(path string, data []byte, perm os.FileMode) error
	RemoveAll(path string) error
}

type MockDirEntry

type MockDirEntry struct {
	mock.Mock
}

MockDirEntry is an autogenerated mock type for the DirEntry type

func NewMockDirEntry

func NewMockDirEntry(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockDirEntry

NewMockDirEntry creates a new instance of MockDirEntry. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockDirEntry) EXPECT

func (_m *MockDirEntry) EXPECT() *MockDirEntry_Expecter

func (*MockDirEntry) Info

func (_m *MockDirEntry) Info() (FileInfo, error)

Info provides a mock function with no fields

func (*MockDirEntry) IsDir

func (_m *MockDirEntry) IsDir() bool

IsDir provides a mock function with no fields

func (*MockDirEntry) Name

func (_m *MockDirEntry) Name() string

Name provides a mock function with no fields

func (*MockDirEntry) Type

func (_m *MockDirEntry) Type() iofs.FileMode

Type provides a mock function with no fields

type MockDirEntry_Expecter

type MockDirEntry_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockDirEntry_Expecter) Info

Info is a helper method to define mock.On call

func (*MockDirEntry_Expecter) IsDir

IsDir is a helper method to define mock.On call

func (*MockDirEntry_Expecter) Name

Name is a helper method to define mock.On call

func (*MockDirEntry_Expecter) Type

Type is a helper method to define mock.On call

type MockDirEntry_Info_Call

type MockDirEntry_Info_Call struct {
	*mock.Call
}

MockDirEntry_Info_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Info'

func (*MockDirEntry_Info_Call) Return

func (*MockDirEntry_Info_Call) Run

func (_c *MockDirEntry_Info_Call) Run(run func()) *MockDirEntry_Info_Call

func (*MockDirEntry_Info_Call) RunAndReturn

func (_c *MockDirEntry_Info_Call) RunAndReturn(run func() (FileInfo, error)) *MockDirEntry_Info_Call

type MockDirEntry_IsDir_Call

type MockDirEntry_IsDir_Call struct {
	*mock.Call
}

MockDirEntry_IsDir_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsDir'

func (*MockDirEntry_IsDir_Call) Return

func (*MockDirEntry_IsDir_Call) Run

func (_c *MockDirEntry_IsDir_Call) Run(run func()) *MockDirEntry_IsDir_Call

func (*MockDirEntry_IsDir_Call) RunAndReturn

func (_c *MockDirEntry_IsDir_Call) RunAndReturn(run func() bool) *MockDirEntry_IsDir_Call

type MockDirEntry_Name_Call

type MockDirEntry_Name_Call struct {
	*mock.Call
}

MockDirEntry_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name'

func (*MockDirEntry_Name_Call) Return

func (*MockDirEntry_Name_Call) Run

func (_c *MockDirEntry_Name_Call) Run(run func()) *MockDirEntry_Name_Call

func (*MockDirEntry_Name_Call) RunAndReturn

func (_c *MockDirEntry_Name_Call) RunAndReturn(run func() string) *MockDirEntry_Name_Call

type MockDirEntry_Type_Call

type MockDirEntry_Type_Call struct {
	*mock.Call
}

MockDirEntry_Type_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Type'

func (*MockDirEntry_Type_Call) Return

func (*MockDirEntry_Type_Call) Run

func (_c *MockDirEntry_Type_Call) Run(run func()) *MockDirEntry_Type_Call

func (*MockDirEntry_Type_Call) RunAndReturn

func (_c *MockDirEntry_Type_Call) RunAndReturn(run func() iofs.FileMode) *MockDirEntry_Type_Call

type MockFileInfo

type MockFileInfo struct {
	mock.Mock
}

MockFileInfo is an autogenerated mock type for the FileInfo type

func NewMockFileInfo

func NewMockFileInfo(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockFileInfo

NewMockFileInfo creates a new instance of MockFileInfo. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockFileInfo) EXPECT

func (_m *MockFileInfo) EXPECT() *MockFileInfo_Expecter

func (*MockFileInfo) IsDir

func (_m *MockFileInfo) IsDir() bool

IsDir provides a mock function with no fields

func (*MockFileInfo) ModTime

func (_m *MockFileInfo) ModTime() time.Time

ModTime provides a mock function with no fields

func (*MockFileInfo) Mode

func (_m *MockFileInfo) Mode() os.FileMode

Mode provides a mock function with no fields

func (*MockFileInfo) Name

func (_m *MockFileInfo) Name() string

Name provides a mock function with no fields

func (*MockFileInfo) Size

func (_m *MockFileInfo) Size() int64

Size provides a mock function with no fields

func (*MockFileInfo) Sys

func (_m *MockFileInfo) Sys() any

Sys provides a mock function with no fields

type MockFileInfo_Expecter

type MockFileInfo_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockFileInfo_Expecter) IsDir

IsDir is a helper method to define mock.On call

func (*MockFileInfo_Expecter) ModTime

ModTime is a helper method to define mock.On call

func (*MockFileInfo_Expecter) Mode

Mode is a helper method to define mock.On call

func (*MockFileInfo_Expecter) Name

Name is a helper method to define mock.On call

func (*MockFileInfo_Expecter) Size

Size is a helper method to define mock.On call

func (*MockFileInfo_Expecter) Sys

Sys is a helper method to define mock.On call

type MockFileInfo_IsDir_Call

type MockFileInfo_IsDir_Call struct {
	*mock.Call
}

MockFileInfo_IsDir_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsDir'

func (*MockFileInfo_IsDir_Call) Return

func (*MockFileInfo_IsDir_Call) Run

func (_c *MockFileInfo_IsDir_Call) Run(run func()) *MockFileInfo_IsDir_Call

func (*MockFileInfo_IsDir_Call) RunAndReturn

func (_c *MockFileInfo_IsDir_Call) RunAndReturn(run func() bool) *MockFileInfo_IsDir_Call

type MockFileInfo_ModTime_Call

type MockFileInfo_ModTime_Call struct {
	*mock.Call
}

MockFileInfo_ModTime_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ModTime'

func (*MockFileInfo_ModTime_Call) Return

func (*MockFileInfo_ModTime_Call) Run

func (*MockFileInfo_ModTime_Call) RunAndReturn

func (_c *MockFileInfo_ModTime_Call) RunAndReturn(run func() time.Time) *MockFileInfo_ModTime_Call

type MockFileInfo_Mode_Call

type MockFileInfo_Mode_Call struct {
	*mock.Call
}

MockFileInfo_Mode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Mode'

func (*MockFileInfo_Mode_Call) Return

func (*MockFileInfo_Mode_Call) Run

func (_c *MockFileInfo_Mode_Call) Run(run func()) *MockFileInfo_Mode_Call

func (*MockFileInfo_Mode_Call) RunAndReturn

func (_c *MockFileInfo_Mode_Call) RunAndReturn(run func() os.FileMode) *MockFileInfo_Mode_Call

type MockFileInfo_Name_Call

type MockFileInfo_Name_Call struct {
	*mock.Call
}

MockFileInfo_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name'

func (*MockFileInfo_Name_Call) Return

func (*MockFileInfo_Name_Call) Run

func (_c *MockFileInfo_Name_Call) Run(run func()) *MockFileInfo_Name_Call

func (*MockFileInfo_Name_Call) RunAndReturn

func (_c *MockFileInfo_Name_Call) RunAndReturn(run func() string) *MockFileInfo_Name_Call

type MockFileInfo_Size_Call

type MockFileInfo_Size_Call struct {
	*mock.Call
}

MockFileInfo_Size_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Size'

func (*MockFileInfo_Size_Call) Return

func (*MockFileInfo_Size_Call) Run

func (_c *MockFileInfo_Size_Call) Run(run func()) *MockFileInfo_Size_Call

func (*MockFileInfo_Size_Call) RunAndReturn

func (_c *MockFileInfo_Size_Call) RunAndReturn(run func() int64) *MockFileInfo_Size_Call

type MockFileInfo_Sys_Call

type MockFileInfo_Sys_Call struct {
	*mock.Call
}

MockFileInfo_Sys_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Sys'

func (*MockFileInfo_Sys_Call) Return

func (*MockFileInfo_Sys_Call) Run

func (_c *MockFileInfo_Sys_Call) Run(run func()) *MockFileInfo_Sys_Call

func (*MockFileInfo_Sys_Call) RunAndReturn

func (_c *MockFileInfo_Sys_Call) RunAndReturn(run func() any) *MockFileInfo_Sys_Call

type MockFileSystem

type MockFileSystem struct {
	mock.Mock
}

MockFileSystem is an autogenerated mock type for the FileSystem type

func NewMockFileSystem

func NewMockFileSystem(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockFileSystem

NewMockFileSystem creates a new instance of MockFileSystem. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockFileSystem) EXPECT

func (*MockFileSystem) Getwd

func (_m *MockFileSystem) Getwd() (string, error)

Getwd provides a mock function with no fields

func (*MockFileSystem) ReadDir

func (_m *MockFileSystem) ReadDir(path string) ([]DirEntry, error)

ReadDir provides a mock function with given fields: path

func (*MockFileSystem) RemoveAll

func (_m *MockFileSystem) RemoveAll(path string) error

RemoveAll provides a mock function with given fields: path

func (*MockFileSystem) Stat

func (_m *MockFileSystem) Stat(path string) (FileInfo, error)

Stat provides a mock function with given fields: path

func (*MockFileSystem) WriteFile

func (_m *MockFileSystem) WriteFile(path string, data []byte, perm os.FileMode) error

WriteFile provides a mock function with given fields: path, data, perm

type MockFileSystem_Expecter

type MockFileSystem_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockFileSystem_Expecter) Getwd

Getwd is a helper method to define mock.On call

func (*MockFileSystem_Expecter) ReadDir

func (_e *MockFileSystem_Expecter) ReadDir(path interface{}) *MockFileSystem_ReadDir_Call

ReadDir is a helper method to define mock.On call

  • path string

func (*MockFileSystem_Expecter) RemoveAll

func (_e *MockFileSystem_Expecter) RemoveAll(path interface{}) *MockFileSystem_RemoveAll_Call

RemoveAll is a helper method to define mock.On call

  • path string

func (*MockFileSystem_Expecter) Stat

func (_e *MockFileSystem_Expecter) Stat(path interface{}) *MockFileSystem_Stat_Call

Stat is a helper method to define mock.On call

  • path string

func (*MockFileSystem_Expecter) WriteFile

func (_e *MockFileSystem_Expecter) WriteFile(path interface{}, data interface{}, perm interface{}) *MockFileSystem_WriteFile_Call

WriteFile is a helper method to define mock.On call

  • path string
  • data []byte
  • perm os.FileMode

type MockFileSystem_Getwd_Call

type MockFileSystem_Getwd_Call struct {
	*mock.Call
}

MockFileSystem_Getwd_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Getwd'

func (*MockFileSystem_Getwd_Call) Return

func (*MockFileSystem_Getwd_Call) Run

func (*MockFileSystem_Getwd_Call) RunAndReturn

func (_c *MockFileSystem_Getwd_Call) RunAndReturn(run func() (string, error)) *MockFileSystem_Getwd_Call

type MockFileSystem_ReadDir_Call

type MockFileSystem_ReadDir_Call struct {
	*mock.Call
}

MockFileSystem_ReadDir_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReadDir'

func (*MockFileSystem_ReadDir_Call) Return

func (*MockFileSystem_ReadDir_Call) Run

func (*MockFileSystem_ReadDir_Call) RunAndReturn

type MockFileSystem_RemoveAll_Call

type MockFileSystem_RemoveAll_Call struct {
	*mock.Call
}

MockFileSystem_RemoveAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveAll'

func (*MockFileSystem_RemoveAll_Call) Return

func (*MockFileSystem_RemoveAll_Call) Run

func (*MockFileSystem_RemoveAll_Call) RunAndReturn

type MockFileSystem_Stat_Call

type MockFileSystem_Stat_Call struct {
	*mock.Call
}

MockFileSystem_Stat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stat'

func (*MockFileSystem_Stat_Call) Return

func (*MockFileSystem_Stat_Call) Run

func (_c *MockFileSystem_Stat_Call) Run(run func(path string)) *MockFileSystem_Stat_Call

func (*MockFileSystem_Stat_Call) RunAndReturn

func (_c *MockFileSystem_Stat_Call) RunAndReturn(run func(string) (FileInfo, error)) *MockFileSystem_Stat_Call

type MockFileSystem_WriteFile_Call

type MockFileSystem_WriteFile_Call struct {
	*mock.Call
}

MockFileSystem_WriteFile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WriteFile'

func (*MockFileSystem_WriteFile_Call) Return

func (*MockFileSystem_WriteFile_Call) Run

func (_c *MockFileSystem_WriteFile_Call) Run(run func(path string, data []byte, perm os.FileMode)) *MockFileSystem_WriteFile_Call

func (*MockFileSystem_WriteFile_Call) RunAndReturn

type OSFileSystem

type OSFileSystem struct{}

func New

func New() *OSFileSystem

func (*OSFileSystem) Getwd

func (f *OSFileSystem) Getwd() (string, error)

func (*OSFileSystem) ReadDir

func (f *OSFileSystem) ReadDir(path string) ([]DirEntry, error)

func (*OSFileSystem) RemoveAll

func (f *OSFileSystem) RemoveAll(path string) error

func (*OSFileSystem) Stat

func (f *OSFileSystem) Stat(path string) (FileInfo, error)

func (*OSFileSystem) WriteFile

func (f *OSFileSystem) WriteFile(path string, data []byte, perm os.FileMode) error

Jump to

Keyboard shortcuts

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