summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Collins <[email protected]>2013-01-20 18:43:14 -0600
committerDave Collins <[email protected]>2013-01-20 18:43:14 -0600
commitddb71712f6991a9a29c06a6ad1e118fdadb0520d (patch)
treeb21777430edf7f68780b68f6f7e9dd1110b681a0
parenta5085b9f9cc2e6ded285b24c812394d8b1525320 (diff)
Add test for max depth option.
-rw-r--r--spew/spew_test.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/spew/spew_test.go b/spew/spew_test.go
index 25b277f..777d0f6 100644
--- a/spew/spew_test.go
+++ b/spew/spew_test.go
@@ -118,6 +118,17 @@ func initSpewTests() {
ts := stringer("test")
tps := pstringer("test")
+ // depthTester is used to test max depth handling for structs, array, slices
+ // and maps.
+ type depthTester struct {
+ ic indirCir1
+ arr [1]string
+ slice []string
+ m map[string]int
+ }
+ dt := depthTester{indirCir1{nil}, [1]string{"arr"}, []string{"slice"},
+ map[string]int{"one": 1}}
+
spewTests = []spewTest{
{scsDefault, fCSFdump, "", int8(127), "(int8) 127\n"},
{scsDefault, fCSFprint, "", int16(32767), "32767"},
@@ -140,7 +151,7 @@ func initSpewTests() {
{scsNoPmethods, fCSFprint, "", &ts, "<*>stringer test"},
{scsNoPmethods, fCSFprint, "", tps, "test"},
{scsNoPmethods, fCSFprint, "", &tps, "<*>stringer test"},
- {scsMaxDepth, fCSFprint, "", &tps, "<*>stringer test"},
+ {scsMaxDepth, fCSFprint, "", dt, "{{<max>} [<max>] [<max>] map[<max>]}"},
}
}