Documentation
¶
Overview ¶
Package fstest provides a contract test suite shared by every FileSystem implementation in go-bash. Each implementation invokes Run(t, Suite{...}) from its own _test.go to validate the common semantic subset.
The suite tests the operations enumerated in the spec: file CRUD, dir CRUD, rename, hard link, symlink, lstat, readlink, realpath, chmod, chtimes, mkdir recursive, rm recursive, walk — plus the path-safety invariants (null-byte rejection, traversal containment).
Implementations carry slightly different capabilities (e.g. read-only filesystems, or filesystems that disallow symlinks for security). The Suite struct lets each adapter declare which behaviors to test.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Factory ¶
type Factory func(t *testing.T) (gobashfs.FileSystem, func())
Factory builds a fresh FileSystem rooted at an isolated directory for each subtest. The cleanup func is called at the end of every subtest. If the implementation is purely in-memory, cleanup may be a no-op.
type Suite ¶
type Suite struct {
Name string
New Factory
SupportsSymlnk bool // implementation honors Symlink/Readlink/Lstat
SupportsHardLn bool // implementation honors Link with shared content
SupportsChmod bool
SupportsChtime bool
// SandboxRoot, if non-empty, is the absolute path under which writes
// land. Tests that exercise "/" semantics use SandboxRoot+"/x" instead.
SandboxRoot string
}
Suite enumerates the optional capabilities an implementation can opt into. Tests guarded by a false flag are silently skipped.