Skip to content

test: cover Run-with-no-arguments paths (#2406) - #2407

Merged
dearchap merged 1 commit into
urfave:mainfrom
dearchap:issue_2406
Aug 16, 2026
Merged

test: cover Run-with-no-arguments paths (#2406)#2407
dearchap merged 1 commit into
urfave:mainfrom
dearchap:issue_2406

Conversation

@dearchap

@dearchap dearchap commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • cleanup

What this PR does / why we need it:

Follow-up to #2401 (index out of range panic fix). Hardens coverage of the Run-with-no-arguments paths:

  • command_test.go: adds a TestRunWithNoOsArgs case combining empty arguments with an empty Name and EnableShellCompletion — the only path where both new guards fire together (setupDefaults empty-name guard plus the shell-completion buildCompletionCommand("") append). Verified to panic without the Fix index out of range panic when Run is given no arguments #2401 fix and pass with it.
  • command_test.go: TestRunWithNoOsArgs now asserts cmd.Name == "" after Run for the unnamed cases, locking in the documented behavior that a root command keeps an empty Name rather than panicking.

Which issue(s) this PR fixes:

Fixes #2406

Special notes for your reviewer:

No behavior change; pure test/robustness hardening.

Testing

Release Notes

NONE

Add a TestRunWithNoOsArgs case combining empty arguments with an empty
Name and EnableShellCompletion, the only path that exercises both the
setupDefaults empty-name guard and the buildCompletionCommand("") append
together. Also assert the root command keeps an empty Name after Run for
the unnamed cases, locking in the documented no-arg behavior.
@dearchap
dearchap requested a review from a team as a code owner August 16, 2026 12:26
@dearchap
dearchap merged commit 141d89c into urfave:main Aug 16, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: improve coverage of Run-with-no-arguments paths

1 participant