package main import ( "io" "testing" ) // A malformed --repo must fail the command (so main exits non-zero). ParseRepo // rejects it before any Vault/Gitea call, so this stays hermetic. func TestExecuteBadRepoErrors(t *testing.T) { cmd := newRootCmd() cmd.SetArgs([]string{"pr", "create", "--repo", "not-a-repo", "--base", "main", "--head", "x", "--title", "t"}) cmd.SetOut(io.Discard) cmd.SetErr(io.Discard) if err := cmd.Execute(); err == nil { t.Fatal("Execute() = nil, want error for a malformed --repo") } }