refactor(#154): use flag-name lookup in InvalidRepo and InvalidPRNumber tests
PR Ready Gate / clear-labels (pull_request) Successful in 2s
CI / test (pull_request) Successful in 17s
CI / review (anthropic--claude-4.6-sonnet, sonnet, SONNET_REVIEW_TOKEN) (pull_request) Successful in 25s
CI / review (gpt-5, security, ., rodin/security-patterns, SECURITY_REVIEW.md, SECURITY_REVIEW_TOKEN) (pull_request) Successful in 37s
CI / review (gpt-5, gpt, GPT_REVIEW_TOKEN) (pull_request) Successful in 1m1s
PR Ready Gate / clear-labels (pull_request) Successful in 2s
CI / test (pull_request) Successful in 17s
CI / review (anthropic--claude-4.6-sonnet, sonnet, SONNET_REVIEW_TOKEN) (pull_request) Successful in 25s
CI / review (gpt-5, security, ., rodin/security-patterns, SECURITY_REVIEW.md, SECURITY_REVIEW_TOKEN) (pull_request) Successful in 37s
CI / review (gpt-5, gpt, GPT_REVIEW_TOKEN) (pull_request) Successful in 1m1s
Make the override code robust against base-arg order changes: search for
the flag name ('--repo', '--pr') and replace the following value, rather
than searching for the value string itself.
This prevents a subtle bug if the same value appeared elsewhere in the
base args before the target flag.
This commit is contained in:
@@ -902,10 +902,10 @@ func TestMainSubprocess_InvalidRepo(t *testing.T) {
|
||||
if os.Getenv("TEST_SUBPROCESS_MAIN") == "1" {
|
||||
flag.CommandLine = flag.NewFlagSet(os.Args[0], flag.ExitOnError)
|
||||
args := baseSubprocessArgs()
|
||||
// Replace the canonical --repo with an invalid one.
|
||||
// Replace the canonical --repo value with an invalid one.
|
||||
for i, a := range args {
|
||||
if a == "owner/repo" {
|
||||
args[i] = "invalidrepo"
|
||||
if a == "--repo" && i+1 < len(args) {
|
||||
args[i+1] = "invalidrepo"
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -931,8 +931,8 @@ func TestMainSubprocess_InvalidPRNumber(t *testing.T) {
|
||||
args := baseSubprocessArgs()
|
||||
// Replace the canonical --pr value with a non-numeric string.
|
||||
for i, a := range args {
|
||||
if a == "1" {
|
||||
args[i] = "notanumber"
|
||||
if a == "--pr" && i+1 < len(args) {
|
||||
args[i+1] = "notanumber"
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user