Skip to content

test: cover Command.FlagNames parent lookup, Command.Count unknown-flag path, and HandleExitCoder direct ErrorFormatter - #2538

Open
Chris-cez wants to merge 1 commit into
urfave:mainfrom
Chris-cez:test/cover-flagnames-count-errorformatter
Open

Chris-cez wants to merge 1 commit into
urfave:mainfrom
Chris-cez:test/cover-flagnames-count-errorformatter

Conversation

@Chris-cez

@Chris-cez Chris-cez commented Nov 14, 2026 •

Copy link
Copy Markdown

What type of PR is this?

  • cleanup

What this PR does / why we need it:

Adds test-only coverage for three branches that were only exercised indirectly (or not at all) by the existing suite:

  • Command.FlagNames merging in parent command flag names
  • Command.Count returning 0 for an unknown flag name
  • HandleExitCoder handling an ErrorFormatter/ExitCoder passed directly (not nested in a MultiError), which hits the fmt.Fprintf("%+v\n", err) branch — existing tests only exercised the MultiError path via handleMultiError's fmt.Fprintln

No production code changes.

Which issue(s) this PR fixes:

Fixes #2537

Testing

Ran go test ./... locally; all tests pass. Verified each new test fails if the corresponding branch is removed/broken.

Release Notes

NONE

…ag path, and HandleExitCoder direct ErrorFormatter branch

These three branches were exercised by existing fixtures only indirectly
and showed up as uncovered in `go tool cover -func`. No production code
changes; test-only additions to close the gaps.
@Chris-cez
Chris-cez requested a review from a team as a code owner November 14, 2026 15:22

This branch has not been deployed

No deployments
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 coverage gaps: Command.FlagNames parent lookup, Command.Count unknown flag, HandleExitCoder direct ErrorFormatter

1 participant