Optional hunk size - #167
Merged
Merged
Conversation
assert.New(t) and require.New(t) now accept Option values. WithHunkSize is the only one so far: it sets how many unchanged lines the diff shows around each change in the failure message of Equal, EqualT, EqualValues, EqualExportedValues and Exactly. The default stays 1. BuildOptions folds the options into an unexported options value that the forward methods append to msgAndArgs, and splitArgs pulls it back out before the message is formatted, so it never reaches the reader. The same door would let a caller pass an Option straight to a top-level function; that case is left commented out in splitArgs, so assert.Equal(t, ...) keeps its signature and a hunk size of 1. Codegen: - the forward and format templates render the o field, the opts parameter on New, and the call carrying a.o; forwardArgs takes variadic extras; - a new "excluded:" comment tag keeps a function out of the generated packages, the domain pages and the metrics. BuildOptions carries it, since it returns an opaque any and has no business in assert/require. Refers to stretchr#1878. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015qDqrLvtn2K5uA6RpSoHvR Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
WithHunkSize said only "modifies the size of the hunk context in diff". It now names the five assertions that render a diff (Equal, EqualT, EqualValues, EqualExportedValues, Exactly), states the default of 1, the clamp below 1, the whole-value case above the rendered length, and shows the call. USAGE.md gains a "Widening the Diff Context" section under Customization, comparing the real output of the same struct at hunk size 1 and 4, and a warning that options ride on the Assertions object: assert.Equal at package level always uses a hunk size of 1. The Forward Methods section links to it. CHANGES.md records the option under Major Additions. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015qDqrLvtn2K5uA6RpSoHvR Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Moves stretchr#1878 from Monitoring to Adapted, restricted to the forward methods, and starts monitoring stretchr#1945 (a Must helper returning a value when there is no error). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015qDqrLvtn2K5uA6RpSoHvR Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #167 +/- ##
==========================================
- Coverage 93.71% 93.67% -0.05%
==========================================
Files 103 104 +1
Lines 13937 13991 +54
==========================================
+ Hits 13061 13106 +45
- Misses 869 878 +9
Partials 7 7 ☔ View full report in Codecov by Harness. |
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.
Change type
Please select: 🆕 New feature or enhancement|🔧 Bug fix'|📃 Documentation update
Short description
Fixes
Full description
Checklist