summaryrefslogtreecommitdiff
path: root/spew
diff options
context:
space:
mode:
authorDave Collins <[email protected]>2013-03-11 18:17:45 -0500
committerDave Collins <[email protected]>2013-03-11 18:17:45 -0500
commit35ec0796c82f6ba58fce49ddb971a106834fbe82 (patch)
tree2d4325e7c6ceab6da0a2a190ad3fc75fc40af4b1 /spew
parent3a62f585a795096661480fd3eed87a505dac5d09 (diff)
Add tests for new Sdump function.
This commit adds tests for the new Sdump function both at the package level and as a part of a ConfigState.
Diffstat (limited to 'spew')
-rw-r--r--spew/spew_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/spew/spew_test.go b/spew/spew_test.go
index 6101559..bbb531b 100644
--- a/spew/spew_test.go
+++ b/spew/spew_test.go
@@ -36,6 +36,7 @@ const (
fCSFprintln
fCSPrint
fCSPrintln
+ fCSSdump
fCSSprint
fCSSprintf
fCSSprintln
@@ -46,6 +47,7 @@ const (
fFprintln
fPrint
fPrintln
+ fSdump
fSprint
fSprintf
fSprintln
@@ -57,6 +59,7 @@ var spewFuncStrings = map[spewFunc]string{
fCSFprint: "ConfigState.Fprint",
fCSFprintf: "ConfigState.Fprintf",
fCSFprintln: "ConfigState.Fprintln",
+ fCSSdump: "ConfigState.Sdump",
fCSPrint: "ConfigState.Print",
fCSPrintln: "ConfigState.Println",
fCSSprint: "ConfigState.Sprint",
@@ -69,6 +72,7 @@ var spewFuncStrings = map[spewFunc]string{
fFprintln: "spew.Fprintln",
fPrint: "spew.Print",
fPrintln: "spew.Println",
+ fSdump: "spew.Sdump",
fSprint: "spew.Sprint",
fSprintf: "spew.Sprintf",
fSprintln: "spew.Sprintln",
@@ -152,6 +156,7 @@ func initSpewTests() {
{scsDefault, fCSFprintln, "", int(2147483647), "2147483647\n"},
{scsDefault, fCSPrint, "", int64(9223372036854775807), "9223372036854775807"},
{scsDefault, fCSPrintln, "", uint8(255), "255\n"},
+ {scsDefault, fCSSdump, "", uint8(64), "(uint8) 64\n"},
{scsDefault, fCSSprint, "", complex(1, 2), "(1+2i)"},
{scsDefault, fCSSprintf, "%v", complex(float32(3), 4), "(3+4i)"},
{scsDefault, fCSSprintln, "", complex(float64(5), 6), "(5+6i)\n"},
@@ -162,6 +167,7 @@ func initSpewTests() {
{scsDefault, fFprintln, "", float64(6.28), "6.28\n"},
{scsDefault, fPrint, "", true, "true"},
{scsDefault, fPrintln, "", false, "false\n"},
+ {scsDefault, fSdump, "", complex(-10, -20), "(complex128) (-10-20i)\n"},
{scsDefault, fSprint, "", complex(-1, -2), "(-1-2i)"},
{scsDefault, fSprintf, "%v", complex(float32(-3), -4), "(-3-4i)"},
{scsDefault, fSprintln, "", complex(float64(-5), -6), "(-5-6i)\n"},
@@ -224,6 +230,10 @@ func TestSpew(t *testing.T) {
}
buf.Write(b)
+ case fCSSdump:
+ str := test.cs.Sdump(test.in)
+ buf.WriteString(str)
+
case fCSSprint:
str := test.cs.Sprint(test.in)
buf.WriteString(str)
@@ -269,6 +279,10 @@ func TestSpew(t *testing.T) {
}
buf.Write(b)
+ case fSdump:
+ str := spew.Sdump(test.in)
+ buf.WriteString(str)
+
case fSprint:
str := spew.Sprint(test.in)
buf.WriteString(str)