Add test coverage for nil Len() behavior#142
Conversation
|
Hey @veeceey , Thanks for the contribution. This test case looks good to me but can you please resolve the failing lint CI ! |
|
Thanks for the review, @ritikrajdev! I looked into the lint failure and it's not related to my changes — the The lint job last passed on main on Jan 30 when an older golangci-lint version was in use. Since then, the latest version has moved to v2.9.0 and any new PR branch will hit this same failure. This is a pre-existing CI configuration issue — not caused by the test I added. All actual test jobs (linux and windows across Go 1.13, oldstable, and stable) pass. |
|
can you please pull the latest changes once! |
f15b2a8 to
11135dd
Compare
|
Hey @ritikrajdev — I rebased on latest main, but the lint failure will persist since it's a pre-existing CI issue: All actual test jobs (Linux + Windows across Go 1.13, oldstable, and stable) pass cleanly. The fix would be to either pin the golangci-lint version in CI or update the minimum Go version, but that's outside the scope of this PR. Let me know if there's anything else I can do! |
|
This test actually looks ok to me, let me quickly fix the CI and merge it! |
|
Hey the fix is now merged in main, feel please update the branch. |
The nil check in Len() was added in PR hashicorp#95 but lacked test coverage. This adds TestLenNil to verify that calling Len() on a nil *Error returns 0 instead of panicking. Fixes hashicorp#54
11135dd to
cb21984
Compare
|
rebased onto latest main - should be good to go now! |
|
Already rebased on latest main — should be good to go now. The CI fix from #147 is included. |
Summary
The nil check in
Len()was added in PR #95 but didn't include test coverage. This PR addsTestLenNilto verify that callingLen()on a nil*Errorreturns 0 instead of panicking.Test Results
$ go test ./... -v ... === RUN TestLenNil --- PASS: TestLenNil (0.00s) PASS ok github.com/hashicorp/go-multierror 0.243sVerified manually that nil and empty multierror both return 0:
Fixes #54