Permalink
Browse files

Added test for err slicing.

  • Loading branch information...
1 parent 5457f3a commit f019b40b3db985e14e3f53fef0fc2e2061ca377e @dustin dustin committed Mar 25, 2013
Showing with 20 additions and 0 deletions.
  1. +20 −0 registry_test.go
View
@@ -1,6 +1,7 @@
package main
import (
+ "fmt"
"testing"
)
@@ -25,3 +26,22 @@ func TestServerIDValidation(t *testing.T) {
}
}
}
+
+func TestErrSlice(t *testing.T) {
+ tests := []struct {
+ e error
+ exp string
+ }{
+ {&errslice{}, "{Errors: }"},
+ {&errslice{fmt.Errorf("a")}, "{Errors: a}"},
+ {&errslice{fmt.Errorf("a"),
+ fmt.Errorf("b")}, "{Errors: a, b}"},
+ }
+
+ for _, tc := range tests {
+ if tc.e.Error() != tc.exp {
+ t.Errorf("Expected %q, got %q for %v",
+ tc.exp, tc.e.Error(), tc.e)
+ }
+ }
+}

0 comments on commit f019b40

Please sign in to comment.