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 - docs/foo.md
`) `)
var code int // A covered file with all docs existing → clean.
stdout, _ := captureOutput(func() { code, stdout, _ := stdinValidateDocmap(t,
code = runValidateDocmap([]string{ "lib/foo/bar.ex\n",
"--docmap", docmap, []string{"--docmap", docmap, "--repo-root", dir},
"--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.
if code != 0 { 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") { if !strings.Contains(stdout, "OK") {
t.Errorf("expected 'OK' in stdout, got %q", stdout) t.Errorf("expected 'OK' in stdout, got %q", stdout)
7