Repository navigation
Conversation
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
Closes #400.
assert.Equalandassert.EqualValuesprinted unsigned integers in hex format in diff output becauseformatUnequalValuesused%#v, which rendersuintvalues as0x6a5instead of1701. This made error messages confusing and hard to read.Fix
Added a
formatValuehelper that uses%vfor unsigned integer kinds (uintthroughuintptr) to produce decimal output, while keeping%#vfor all other types to preserve struct field names and string quotes. Updated both code paths informatUnequalValues: the cross-type path (%T(%s)) and the same-type path.Before
After
Testing
TestFormatUnequalValues— extended with two new cases:uint(1700)vsuint(1701)→1700/1701(same type, no prefix)uint(1700)vsint(1701)→uint(1700)/int(1701)(cross type, with prefix)go test -run TestFormatUnequalValues ./assert/→ PASSgo vet ./...→ cleangofmt -l assert/assertions.go assert/assertions_test.go→ cleanPre-existing failures in
assert(4 symlink tests on Windows) andsuite(panic/signature tests) are unrelated to this change — reproduced identically in a clean worktree at base commit87a7b9d.Backward compatibility
The only behavior change is that unsigned integers now display as decimal instead of hex in assertion failure messages. No API changes, no logic changes in equality checks.