Documentation
¶
Index ¶
- func Chdir(t *testing.T, dir string)
- func SetupGitRepo(t *testing.T) string
- func SetupGitRepoWithHook(t *testing.T) string
- func SetupLoreDir(t *testing.T) string
- func SetupLoreDirWithDocs(t *testing.T, docs []DocFixture) string
- func TestConfig() *config.Config
- func TestStreams() (domain.IOStreams, *bytes.Buffer, *bytes.Buffer)
- type DocFixture
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Chdir ¶
Chdir changes the working directory to dir and registers a t.Cleanup to restore the original CWD. Use this when commands under test rely on os.Getwd() to find .lore/.
WARNING: not goroutine-safe — tests using Chdir must NOT call t.Parallel(). Process-wide CWD is shared state; parallel tests would race on it.
func SetupGitRepo ¶
SetupGitRepo creates a temporary Git repo (git init) and returns its path. Uses t.TempDir() for auto-cleanup. Does NOT chdir — the caller uses the returned path explicitly.
func SetupGitRepoWithHook ¶
SetupGitRepoWithHook creates a Git repo with a lore post-commit hook marker installed. Returns the repo path.
NOTE: hook content is hardcoded here and may drift from the actual hook installed by git.installHook (which reads from an embedded script). testutil cannot import git/ (import boundary). If the hook format changes, update this fixture accordingly.
func SetupLoreDir ¶
SetupLoreDir creates a minimal .lore/ structure (docs/, templates/, pending/) in a t.TempDir(). Does NOT chdir. Returns the temp dir path.
func SetupLoreDirWithDocs ¶
func SetupLoreDirWithDocs(t *testing.T, docs []DocFixture) string
SetupLoreDirWithDocs creates .lore/ with pre-existing document files. Each DocFixture generates a properly formatted .md file in .lore/docs/. Returns the temp dir path.