diff --git a/cmd/review-bot/validatedocmap_test.go b/cmd/review-bot/validatedocmap_test.go index b19ec4f..55da6f7 100644 --- a/cmd/review-bot/validatedocmap_test.go +++ b/cmd/review-bot/validatedocmap_test.go @@ -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)