From 5cc287d265446302463c4d24fc1b38066413be89 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Sun, 3 Mar 2013 13:21:13 -0600 Subject: Add tests for new ContinueOnMethod option. --- spew/spew_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'spew/spew_test.go') diff --git a/spew/spew_test.go b/spew/spew_test.go index 4978d0d..6101559 100644 --- a/spew/spew_test.go +++ b/spew/spew_test.go @@ -124,6 +124,7 @@ func initSpewTests() { scsNoMethods := &spew.ConfigState{Indent: " ", DisableMethods: true} scsNoPmethods := &spew.ConfigState{Indent: " ", DisablePointerMethods: true} scsMaxDepth := &spew.ConfigState{Indent: " ", MaxDepth: 1} + scsContinue := &spew.ConfigState{Indent: " ", ContinueOnMethod: true} // Variables for tests on types which implement Stringer interface with and // without a pointer receiver. @@ -141,6 +142,9 @@ func initSpewTests() { dt := depthTester{indirCir1{nil}, [1]string{"arr"}, []string{"slice"}, map[string]int{"one": 1}} + // Variable for tests on types which implement error interface. + te := customError(10) + spewTests = []spewTest{ {scsDefault, fCSFdump, "", int8(127), "(int8) 127\n"}, {scsDefault, fCSFprint, "", int16(32767), "32767"}, @@ -175,6 +179,12 @@ func initSpewTests() { " arr: ([1]string) {\n \n },\n" + " slice: ([]string) {\n \n },\n" + " m: (map[string]int) {\n \n }\n}\n"}, + {scsContinue, fCSFprint, "", ts, "(stringer test) test"}, + {scsContinue, fCSFdump, "", ts, "(spew_test.stringer) " + + "(stringer test) \"test\"\n"}, + {scsContinue, fCSFprint, "", te, "(error: 10) 10"}, + {scsContinue, fCSFdump, "", te, "(spew_test.customError) " + + "(error: 10) 10\n"}, } } -- cgit v1.2.3