diff --git a/assert/assertions.go b/assert/assertions.go index a27e70546..dd0a71e2e 100644 --- a/assert/assertions.go +++ b/assert/assertions.go @@ -1985,6 +1985,7 @@ var spewConfig = spew.ConfigState{ DisablePointerAddresses: true, DisableCapacities: true, SortKeys: true, + SpewKeys: true, DisableMethods: true, MaxDepth: 10, } @@ -1994,6 +1995,7 @@ var spewConfigStringerEnabled = spew.ConfigState{ DisablePointerAddresses: true, DisableCapacities: true, SortKeys: true, + SpewKeys: true, MaxDepth: 10, } diff --git a/assert/assertions_test.go b/assert/assertions_test.go index 4975f5e41..d1e57d6b3 100644 --- a/assert/assertions_test.go +++ b/assert/assertions_test.go @@ -2986,6 +2986,28 @@ Diff: expected = ` +Diff: +--- Expected ++++ Actual +@@ -12,3 +12,3 @@ + x: (int) 4 +- }: (int) 4 ++ }: (int) 999 + } +` + + type Key struct { + x int + } + + actual = diff( + map[Key]int{Key{1}: 1, Key{2}: 2, Key{3}: 3, Key{4}: 4}, + map[Key]int{Key{1}: 1, Key{2}: 2, Key{3}: 3, Key{4}: 999}, + ) + Equal(t, expected, actual) + + expected = ` + Diff: --- Expected +++ Actual