feat(#141): validate-docmap subcommand — CI hard-fail on missing docmap coverage #142

Merged
rodin merged 11 commits from issue-141 into main 2026-05-15 07:39:22 +00:00
Showing only changes of commit 2ecbd86e24 - Show all commits
+6 -12
View File
1
@@ -60,19 +60,13 @@ mappings:
- docs/foo.md
`)
var code int
stdout, _ := captureOutput(func() {
code = runValidateDocmap([]string{
"--docmap", docmap,
"--repo-root", dir,
})
})
// Provide stdin via the global os.Stdin would require process tricks.
// The implementation reads os.Stdin directly; for tests we need a different approach.
// See TestRunValidateDocmap_WithStdin_* below which use a helper that replaces os.Stdin.
// This case: empty stdin (no changed files) → clean.
// A covered file with all docs existing → clean.
code, stdout, _ := stdinValidateDocmap(t,
"lib/foo/bar.ex\n",
[]string{"--docmap", docmap, "--repo-root", dir},
)
if code != 0 {
t.Errorf("expected exit 0 for clean (empty stdin), got %d", code)
t.Errorf("expected exit 0 for clean, got %d", code)
}
if !strings.Contains(stdout, "OK") {
t.Errorf("expected 'OK' in stdout, got %q", stdout)
7