repo mirror list: harden --sort test assertions · Entire

repo mirror list: harden --sort test assertions

c1dfc27→main·

gtrrz-victor·1w ago·1 file·+45 added/-26 removed

Two test gaps the review flagged:

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

Sessions

01KX0BW5ZTM66F20FMJ1Z2NW5DView transcript

Changes

1

496 unmodified lines

return err
}

// requireOrder asserts each needle appears in s, in the given order. It guards
// presence first: strings.Index returns -1 for an absent needle, so a bare
// index comparison would pass when the earlier needle is missing entirely
// (-1 < anyPresentIndex). This fails loudly instead.
func requireOrder(t *testing.T, s string, needles ...string) {

t.Helper()
prev := -1
for _, n := range needles {
    i := strings.Index(s, n)
    require.GreaterOrEqualf(t, i, 0, "expected %q in output", n)
    require.Greaterf(t, i, prev, "expected %q to come after the previous item", n)
    prev = i
}
}

// TestRepoMirrorList_FilterSort pins the client-side --repo filter and --sort
// applied to `repo mirror list` before rendering (server handles
// owner/provider/cluster), so they shape both the table and --json output and
... // omitted for brevity

}

Mcmd/entire/cli/repo_mirror_test.go+45/-26