Documentation
¶
Overview ¶
Package testutil provides shared helpers for graith's Go tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GitCommand ¶
GitCommand constructs a Git command with GitEnv applied.
func GitEnv ¶
GitEnv returns a deterministic environment for Git fixture commands. Every inherited GIT_* variable is stripped so host settings cannot redirect the repository, worktree, index, object database, config, SSH command, or hooks. SSH_AUTH_SOCK is also omitted: local-only fixtures never need credentials and must not contact a developer's agent. Optional KEY=value entries override the defaults, which is useful for tests that intentionally exercise --global config with a throwaway HOME.
func IsolateGit ¶
IsolateGit applies GitEnv to the current test process so production helpers invoked in-process (rather than through GitCommand) are hermetic too. Tests using this helper must not run in parallel because environment variables are process-global.
func RunWithIsolatedGit ¶
RunWithIsolatedGit runs a package's tests with the same hermetic Git environment used by GitCommand. Call it from TestMain so production Git helpers invoked anywhere in the package cannot observe host settings.
Types ¶
This section is empty.