summaryrefslogtreecommitdiff
path: root/spew/common_test.go
diff options
context:
space:
mode:
authorDave Collins <[email protected]>2013-01-20 13:41:53 -0600
committerDave Collins <[email protected]>2013-01-20 13:41:53 -0600
commit89496a6569e5cccff78a35628ab4057b11cf85a9 (patch)
tree76b665ea26ade94f3ab90d9419ce308b1da71981 /spew/common_test.go
parent57a610269f12551528d76bd46c84dbbb308cc49c (diff)
Add tests for types with custom Error interface.
Diffstat (limited to 'spew/common_test.go')
-rw-r--r--spew/common_test.go7
1 files changed, 7 insertions, 0 deletions
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 {