...
1 package multierror
2
3 import (
4 "errors"
5 "testing"
6 )
7
8 func TestListFormatFuncSingle(t *testing.T) {
9 expected := `1 error occurred:
10 * foo
11
12 `
13
14 errors := []error{
15 errors.New("foo"),
16 }
17
18 actual := ListFormatFunc(errors)
19 if actual != expected {
20 t.Fatalf("bad: %#v", actual)
21 }
22 }
23
24 func TestListFormatFuncMultiple(t *testing.T) {
25 expected := `2 errors occurred:
26 * foo
27 * bar
28
29 `
30
31 errors := []error{
32 errors.New("foo"),
33 errors.New("bar"),
34 }
35
36 actual := ListFormatFunc(errors)
37 if actual != expected {
38 t.Fatalf("bad: %#v", actual)
39 }
40 }
41
View as plain text