From ad1d81b355a1890f4cd7476b1d1e2e1f52541dd5 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Sun, 20 Jan 2013 12:31:42 -0600 Subject: Add tests for custom type that panics in Stringer. --- spew/spew_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'spew/spew_test.go') 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 -- cgit v1.2.3