diff --git a/cmd/review-bot/main_test.go b/cmd/review-bot/main_test.go index db6d536..540dd5b 100644 --- a/cmd/review-bot/main_test.go +++ b/cmd/review-bot/main_test.go @@ -903,12 +903,17 @@ func TestMainSubprocess_InvalidRepo(t *testing.T) { flag.CommandLine = flag.NewFlagSet(os.Args[0], flag.ExitOnError) args := baseSubprocessArgs() // Replace the canonical --repo value with an invalid one. + found := false for i, a := range args { if a == "--repo" && i+1 < len(args) { args[i+1] = "invalidrepo" + found = true break } } + if !found { + t.Fatal("baseSubprocessArgs() does not contain --repo; test is broken") + } os.Args = args main() return @@ -930,12 +935,17 @@ func TestMainSubprocess_InvalidPRNumber(t *testing.T) { flag.CommandLine = flag.NewFlagSet(os.Args[0], flag.ExitOnError) args := baseSubprocessArgs() // Replace the canonical --pr value with a non-numeric string. + found := false for i, a := range args { if a == "--pr" && i+1 < len(args) { args[i+1] = "notanumber" + found = true break } } + if !found { + t.Fatal("baseSubprocessArgs() does not contain --pr; test is broken") + } os.Args = args main() return