-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror_test.go
54 lines (50 loc) · 988 Bytes
/
error_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package pretty_test
import (
. "github.com/pierrre/pretty"
)
func init() {
addTestCasesPrefix("Error", []*testCase{
{
name: "Default",
value: &testError{},
},
{
name: "Nil",
value: (*testError)(nil),
ignoreBenchmark: true,
},
{
name: "Unexported",
value: testUnexported{v: &testError{}},
configure: func(vw *CommonValueWriter) {
vw.CanInterface = nil
},
ignoreBenchmark: true,
},
{
name: "UnexportedCanInterface",
value: testUnexported{v: &testError{}},
ignoreBenchmark: true,
},
{
name: "Disabled",
value: &testError{},
configure: func(vw *CommonValueWriter) {
vw.Error = nil
},
ignoreBenchmark: true,
},
{
name: "Not",
value: "test",
configure: func(vw *CommonValueWriter) {
vw.ValueWriters = ValueWriters{vw.Error}
},
ignoreBenchmark: true,
},
})
}
type testError struct{}
func (e *testError) Error() string {
return "test"
}