aboutsummaryrefslogtreecommitdiff
path: root/cmp/compare_test.go
diff options
context:
space:
mode:
authorJoe Tsai <joetsai@digital-static.net>2020-11-24 10:26:02 -0800
committerGitHub <noreply@github.com>2020-11-24 10:26:02 -0800
commitec71d6d790538ad88c95a192fd059e11afb45b6f (patch)
treefbd3e5242869d4ca3b168066201a8014e71a1694 /cmp/compare_test.go
parent449e17c6c9daf9b0c84a35fef7d79321b9535763 (diff)
downloadgo-cmp-ec71d6d790538ad88c95a192fd059e11afb45b6f.tar.gz
Impose verbosity limit when formatting map keys (#248)
Map keys should have a sensible verbosity limit imposed, otherwise the reporter can end up printing a massive data structure that cannot reasonably fit in memory.
Diffstat (limited to 'cmp/compare_test.go')
-rw-r--r--cmp/compare_test.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/cmp/compare_test.go b/cmp/compare_test.go
index 13a3a4e..84f7353 100644
--- a/cmp/compare_test.go
+++ b/cmp/compare_test.go
@@ -1276,6 +1276,17 @@ using the AllowUnexported option.`, "\n"),
y: MyComposite{},
wantEqual: false,
reason: "batched diffing for empty slices and nil slices",
+ }, {
+ label: label + "/LargeMapKey",
+ x: map[*[]byte]int{func() *[]byte {
+ b := make([]byte, 1<<20, 1<<20)
+ return &b
+ }(): 0},
+ y: map[*[]byte]int{func() *[]byte {
+ b := make([]byte, 1<<20, 1<<20)
+ return &b
+ }(): 0},
+ reason: "printing map keys should have some verbosity limit imposed",
}}
}