test(errors): cover Wrap/Multi/Join/Is* and category inference (100%)#127
Open
abhicris wants to merge 1 commit into
Open
test(errors): cover Wrap/Multi/Join/Is* and category inference (100%)#127abhicris wants to merge 1 commit into
abhicris wants to merge 1 commit into
Conversation
The github.com/luxfi/node/errors package shipped with zero tests despite being a public utility surface (sentinel errors, WrappedError context chain, Multi/Join aggregation, retry helpers). This adds 22 tests covering: - WrappedError.Error format (with and without message) - Wrap/WrapWithContext nil pass-through and context preservation - errors.Is / errors.As chain through Wrap (incl. double-wrap) - IsNotFound, IsClosed, IsTimeout helpers - IsTemporary against both sentinel errors and the Temporary() interface - IsPermanent across all permanent sentinels + fmt.Errorf %w chains - GetCategory: wrapped category, sentinel inference, unknown fallback, and the precedence rule (wrapped category beats inferred category) - Multi.Error/Add/Err for 0, 1, and N errors; nil-add ignored - Join nil pass-through and multi-error combination Result: 100.0% statement coverage, race-clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
github.com/luxfi/node/errorspackage shipped with zero tests despite being a public utility surface (sentinel errors,WrappedErrorcontext chain,Multi/Joinaggregation, retry helpers likeIsTemporary/IsPermanent). This adds 22 tests that bring the package to 100.0% statement coverage.What is covered
WrappedError.Error()format — with and without an explicit messageWrap/WrapWithContextnil pass-through; context map preservation; allocated-and-writable context on the bareWrappatherrors.Is/errors.Aschain throughWrap(including double-wrap)IsNotFound,IsClosed,IsTimeoutdirect +%wwrappingIsTemporaryagainst both the sentinel set and the optionalTemporary() boolinterfaceIsPermanentacross every permanent sentinel +fmt.Errorf %wchainsGetCategory: wrapped category, sentinel inference, unknown fallback, and the precedence rule (wrapped category beats inferred)Multi.Error/Add/Errat sizes 0, 1, and N; nil-add ignoredJoinnil pass-through and multi-error combinationVerification
Notes
errors/errors.go.header.yml.