Documentation
¶
Index ¶
- func BoolPtr(v bool) *bool
- func ForbidExec(t *testing.T, target *func(string, []string, []string) error)
- func SkipIfReadable(t *testing.T, path string)
- func SkipIfWritable(t *testing.T, path string)
- func WithWorkingDir(t *testing.T, dir string, fn func())
- func WriteStub(t *testing.T, dir string, name string)
- func WriteStubExpectArg(t *testing.T, dir string, name string, expectedArg string)
- func WriteStubWithExit(t *testing.T, dir string, name string, exitCode int)
- type ExecCall
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForbidExec ¶ added in v0.13.0
ForbidExec replaces target with a test failure and restores the original handoff when the test completes.
func SkipIfReadable ¶ added in v0.17.2
SkipIfReadable probes path with a real read attempt after a fixture has restricted its mode bits. A successful probe is closed and the test is skipped so elevated privileges cannot bypass a permission-dependent read or traversal error. Permission denied lets the caller proceed. Any other probe error fails with the protected path and the underlying error.
func SkipIfWritable ¶ added in v0.17.2
SkipIfWritable probes path with a real write or create attempt after a fixture has restricted its mode bits. A successful probe is cleaned up and the test is skipped so elevated privileges cannot make a permission-dependent assertion pass or fail for an environment reason. Permission denied lets the caller proceed. Any other probe error fails with the protected path and the underlying error.
func WithWorkingDir ¶
WithWorkingDir runs fn with dir as the current working directory and restores the previous directory. t is the active test; dir is the temporary working directory for fn.
func WriteStub ¶
WriteStub writes an executable shell stub that exits successfully. t is the active test; dir is the output directory; name is the executable file name.
func WriteStubExpectArg ¶
WriteStubExpectArg writes an executable shell stub that succeeds only when expectedArg is present. t is the active test; dir is the output directory; name is the executable file name.
Types ¶
type ExecCall ¶ added in v0.13.0
ExecCall records one captured executable handoff.
func CaptureExec ¶ added in v0.13.0
CaptureExec replaces target with a one-call capture seam that returns err. It restores the original handoff when the test completes.