Documentation
¶
Overview ¶
Package fsconformance provides a shared conformance test suite for the tool.Workspace interface. Adapters (osfs, memfs, ...) call Run with a factory that constructs a fresh workspace, and the suite exercises only the tool.Workspace interface.
Importing "testing" in a non-_test.go file is intentional here: this is a test-helper package whose sole purpose is to be imported by adapter tests, the conventional Go pattern for shared conformance suites (cf. testing/fstest).
Index ¶
- func Run(t *testing.T, newWS func(t *testing.T) tool.Workspace)
- func RunExternalMutationConflict(t *testing.T, newFixture func(t *testing.T) (tool.Workspace, ExternalAccess))
- func RunMutationAffinity(t *testing.T, newFixture func(t *testing.T) (tool.Workspace, ExternalAccess))
- func RunNamespace(t *testing.T, newWS func(t *testing.T) tool.Workspace)
- type ExternalAccess
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
Run executes the shared Workspace conformance table against the workspace produced by newWS. newWS must return a fresh, isolated workspace each call.
func RunExternalMutationConflict ¶ added in v0.16.0
func RunExternalMutationConflict(t *testing.T, newFixture func(t *testing.T) (tool.Workspace, ExternalAccess))
RunExternalMutationConflict proves a version read before an out-of-band mutation cannot authorize overwriting the newer bytes.
func RunMutationAffinity ¶ added in v0.16.0
func RunMutationAffinity(t *testing.T, newFixture func(t *testing.T) (tool.Workspace, ExternalAccess))
RunMutationAffinity proves Workspace operations and an external actor observe the same backing bytes in both directions.
func RunNamespace ¶ added in v0.15.0
RunNamespace executes the shared tool.WorkspaceNamespace conformance table against the workspace produced by newWS. newWS must return a fresh, isolated workspace each call, and the workspace it returns must implement tool.WorkspaceNamespace (memfs, osfs, redisstore — the POSIX-like namespace adapters); a workspace that does not (ACP, no-fs) pins its own contract directly rather than through this shared suite. Namespace operations are deliberately NOT part of RunNamespace's setup path (setFile stays content-only via CreateFile/ReplaceFile); every case here exercises ReadDir/Remove/Rename/ CopyFile end to end so adapters cannot silently diverge on error-wrapping or on the "directories are derived from file paths" contract.
Types ¶
type ExternalAccess ¶ added in v0.16.0
type ExternalAccess struct {
Read func(path string) ([]byte, error)
Write func(path string, data []byte) error
}
ExternalAccess models another actor in the same execution namespace, such as the Environment's bound CommandRunner. It lets adapters prove Workspace and runner affinity without duplicating the Workspace contract.