vfstest

package
v0.0.0-...-59f12cf Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromMap

func FromMap[File any](m map[string]File, useCaseSensitiveFileNames bool) vfs.FS

FromMap creates a new vfs.FS from a map of paths to file contents. Those file contents may be strings, byte slices, or [fstest.MapFile]s.

The paths must be normalized absolute paths according to the tspath package, without trailing directory separators. The paths must be all POSIX-style or all Windows-style, but not both.

func FromMapWithClock

func FromMapWithClock[File any](m map[string]File, useCaseSensitiveFileNames bool, clock Clock) vfs.FS

FromMapWithClock creates a new vfs.FS from a map of paths to file contents. Those file contents may be strings, byte slices, or [fstest.MapFile]s.

The paths must be normalized absolute paths according to the tspath package, without trailing directory separators. The paths must be all POSIX-style or all Windows-style, but not both.

func Symlink(target string) *fstest.MapFile

Types

type Clock

type Clock interface {
	Now() time.Time
	SinceStart() time.Duration
}

type MapFS

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

func (*MapFS) Chtimes

func (m *MapFS) Chtimes(path string, aTime time.Time, mTime time.Time) error

func (*MapFS) Entries

func (m *MapFS) Entries() iter.Seq2[string, *fstest.MapFile]

func (*MapFS) GetFileInfo

func (m *MapFS) GetFileInfo(path string) *fstest.MapFile

func (*MapFS) GetModTime

func (m *MapFS) GetModTime(path string) time.Time
func (m *MapFS) GetTargetOfSymlink(path string) (string, bool)

func (*MapFS) MkdirAll

func (m *MapFS) MkdirAll(path string, perm fs.FileMode) error

func (*MapFS) Open

func (m *MapFS) Open(name string) (fs.File, error)

func (*MapFS) Realpath

func (m *MapFS) Realpath(name string) (string, error)

func (*MapFS) Remove

func (m *MapFS) Remove(path string) error

func (*MapFS) WriteFile

func (m *MapFS) WriteFile(path string, data []byte, perm fs.FileMode) error

Jump to

Keyboard shortcuts

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