Skip to content

abctl: the casefold breakdown test's second assertion is unreachable on its own fixture #1179

Description

@huang195

Found by the round-3 strict review of #1153, in a test that PR's round 2 added.

cmd/abctl/cmd_cost_test.go, TestRunCost_ByCurrencyMatchesAUnitSpelledADifferentWay:

if strings.Contains(row, mixedCostCell) {
    t.Errorf("a real configured unit was withheld as unrecognised:\n%s", row)
}

The fixture carries "currencies":["Credits"] — one entry — so windowUnit returns labelled=true and writeCostBreakdown's default: cost = mixedCostCell arm is unreachable for a priced row. The assertion cannot fire on this input, and its stated reason ("withheld as unrecognised") describes a path the fixture does not reach.

The test's first assertion is live and does pin the property that matters (a unit spelled differently from the reported set keeps its label, i.e. isReportedUnit folds case). Only the negative twin is dead.

Fix is either a second fixture whose window is genuinely mixed, or dropping the assertion and saying in the comment that the single-unit fixture cannot produce (mixed). Prefer whichever keeps the test's one claim legible.

Assisted-By: Claude (Anthropic AI) noreply@anthropic.com

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions