Documentation
¶
Overview ¶
Package testutil provides small, shared helpers for tests across the codebase.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsolateUserDirs ¶
IsolateUserDirs points every per-user directory root at root so code under test cannot read the developer's real config, cache or home directory, or write to them. It is meant for a package's TestMain, which has no *testing.T (tests that need their own layout still use t.Setenv, which wins while it is active). The returned function restores the previous environment.
It fails closed: if any variable cannot be redirected, the variables it had already changed are restored and an error is returned, so the caller must not run the tests against a partially isolated environment.
func PathWithin ¶
PathWithin reports whether path is root or lies beneath it, comparing the physical forms so symlinked temp dirs (/var vs /private/var on macOS) and Windows short names do not cause false results. Components that do not exist yet are kept as spelled under their nearest existing ancestor.
Types ¶
This section is empty.