package main
import (
"github.com/stretchr/testify/require"
"testing"
)
func TestUnsignedInt(t *testing.T) {
var a uint64 = 1234567
var b uint64 = 98765523
require.Equal(t, a, b, "The two numbers should be the same.")
}
This results in hex-formatted integers:
=== RUN TestUnsignedInt
prog.go:13:
Error Trace: prog.go:13
Error: Not equal:
expected: 0x12d687
actual : 0x5e30ad3
Test: TestUnsignedInt
Messages: The two numbers should be the same.
--- FAIL: TestUnsignedInt (0.00s)
FAIL
=== RUN TestUnsignedInt
prog.go:13:
Error Trace: prog.go:13
Error: Not equal:
expected: 1234567
actual : 98765523
Test: TestUnsignedInt
Messages: The two numbers should be the same.
--- FAIL: TestUnsignedInt (0.00s)
FAIL
Example:
This results in hex-formatted integers:
Replacing
%#v
with%v
intruncatingFormat()
: https://github.com/stretchr/testify/blob/c26b7f39f88ecc339b622fcbe6531ac5fdccd799/assert/assertions.go#L447would result in decimal-formatted integers:
There was a similar issue for
time.Duration
type (#626) which was solved with special casing informatUnequalValue()
: https://github.com/stretchr/testify/blob/c26b7f39f88ecc339b622fcbe6531ac5fdccd799/assert/assertions.go#L435-L438A similar broader thing is tracked in #390.