test: better message for different empty slices (#6920)

Given two empty slices, one that is equal to nil and one that is not,
AssertDeepEquals used to produce this confusing output:

    [[]] !(deep)= [[]]

After this change, it produces:

    [[]string(nil)] !(deep)= [[]string{}]
This commit is contained in:
Jacob Hoffman-Andrews 2023-05-26 09:41:23 -07:00 committed by GitHub
parent efbc2ad89b
commit 521eb55d1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -118,7 +118,7 @@ func AssertEquals(t *testing.T, one interface{}, two interface{}) {
func AssertDeepEquals(t *testing.T, one interface{}, two interface{}) {
t.Helper()
if !reflect.DeepEqual(one, two) {
t.Fatalf("[%+v] !(deep)= [%+v]", one, two)
t.Fatalf("[%#v] !(deep)= [%#v]", one, two)
}
}