Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions internal/reconcile/metaschema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,13 @@ func TestCanonicalJSON(t *testing.T) {
assert.Error(t, err)
})
t.Run("keeps a real difference in a large integer", func(t *testing.T) {
a, err := canonicalJSON(`{"maximum":10000000000000001}`)
// 2^53+1 and 2^53 both round to 2^53 under a float64 decode, so this pair
// fails without the UseNumber decode and passes with it. A larger pair like
// 1e16+1 vs 1e16+2 would round to distinct floats and pass either way, so it
// would not guard the fix.
a, err := canonicalJSON(`{"maximum":9007199254740993}`)
assert.NoError(t, err)
b, err := canonicalJSON(`{"maximum":10000000000000002}`)
b, err := canonicalJSON(`{"maximum":9007199254740992}`)
assert.NoError(t, err)
assert.NotEqual(t, a, b)
})
Expand Down
Loading