summaryrefslogtreecommitdiff
path: root/spew/spew_test.go
diff options
context:
space:
mode:
authorDave Collins <[email protected]>2013-01-20 12:31:42 -0600
committerDave Collins <[email protected]>2013-01-20 12:31:42 -0600
commitad1d81b355a1890f4cd7476b1d1e2e1f52541dd5 (patch)
treec8f7bfe9bb3a55ac1241f7d712dd4e76240f6fab /spew/spew_test.go
parent5c8d842977941cdb1663827b8c6a93046e211bbb (diff)
Add tests for custom type that panics in Stringer.
Diffstat (limited to 'spew/spew_test.go')
-rw-r--r--spew/spew_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/spew/spew_test.go b/spew/spew_test.go
index 406edc1..76df103 100644
--- a/spew/spew_test.go
+++ b/spew/spew_test.go
@@ -50,6 +50,14 @@ func testFailed(result string, wants []string) bool {
return true
}
+// panicer is used to intentionally cause a panic for testing spew properly
+// handles them
+type panicer int
+
+func (p panicer) String() string {
+ panic("test panic")
+}
+
// spewFunc is used to identify which public function of the spew package or
// ConfigState a test applies to.
type spewFunc int