-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslice_test.go
86 lines (84 loc) · 1.65 KB
/
slice_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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package pretty_test
import (
. "github.com/pierrre/pretty"
)
func init() {
addTestCasesPrefix("Slice", []*testCase{
{
name: "Default",
value: []int{1, 2, 3},
},
{
name: "Nil",
value: []int(nil),
ignoreBenchmark: true,
},
{
name: "ShowAddr",
value: []int{1, 2, 3},
configure: func(vw *CommonValueWriter) {
vw.Kind.BaseSlice.ShowAddr = true
},
ignoreResult: true,
ignoreBenchmark: true,
},
{
name: "ShowLenDisabled",
value: []int{1, 2, 3},
configure: func(vw *CommonValueWriter) {
vw.SetShowLen(false)
vw.SetShowCap(false)
},
ignoreBenchmark: true,
},
{
name: "ShowCap",
value: []int{1, 2, 3},
configure: func(vw *CommonValueWriter) {
vw.SetShowCap(true)
},
ignoreBenchmark: true,
},
{
name: "ShowIndexes",
value: []int{1, 2, 3},
configure: func(vw *CommonValueWriter) {
vw.Kind.BaseSlice.ShowIndexes = true
},
},
{
name: "Empty",
value: []int{},
ignoreBenchmark: true,
},
{
name: "Truncated",
value: []int{1, 2, 3},
configure: func(vw *CommonValueWriter) {
vw.Kind.BaseSlice.MaxLen = 2
},
ignoreBenchmark: true,
},
{
name: "UnknownType",
value: []any{1, 2, 3},
ignoreBenchmark: true,
},
{
name: "ShowKnownTypes",
value: []int{1, 2, 3},
configure: func(vw *CommonValueWriter) {
vw.TypeAndValue.ShowKnownTypes = true
},
ignoreBenchmark: true,
},
{
name: "Not",
value: "test",
configure: func(vw *CommonValueWriter) {
vw.ValueWriters = ValueWriters{vw.Kind.BaseSlice}
},
ignoreBenchmark: true,
},
})
}