From 89496a6569e5cccff78a35628ab4057b11cf85a9 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Sun, 20 Jan 2013 13:41:53 -0600 Subject: Add tests for types with custom Error interface. --- spew/common_test.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'spew/common_test.go') diff --git a/spew/common_test.go b/spew/common_test.go index 78b1f81..f0119e6 100644 --- a/spew/common_test.go +++ b/spew/common_test.go @@ -58,6 +58,13 @@ func (p panicer) String() string { panic("test panic") } +// customError is used to test custom error interface invocation. +type customError int + +func (e customError) Error() string { + return fmt.Sprintf("error: %d", int(e)) +} + // stringizeWants converts a slice of wanted test output into a format suitable // for an test error message. func stringizeWants(wants []string) string { -- cgit v1.2.3