-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunsafe_pointer_test.go
More file actions
47 lines (44 loc) · 986 Bytes
/
unsafe_pointer_test.go
File metadata and controls
47 lines (44 loc) · 986 Bytes
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
package pretty_test
import (
"unsafe" //nolint:depguard // Required for test.
. "github.com/pierrre/pretty"
"github.com/pierrre/pretty/internal/prettytest"
)
func init() {
prettytest.AddCasesPrefix("UnsafePointer", []*prettytest.Case{
{
Name: "Default",
Value: func() unsafe.Pointer {
i := 123
return unsafe.Pointer(&i) //nolint:gosec // It's OK.
}(),
IgnoreResult: true,
},
{
Name: "Nil",
Value: func() unsafe.Pointer {
return unsafe.Pointer(nil) //nolint:gosec // It's OK.
}(),
IgnoreBenchmark: true,
},
{
Name: "SupportDisabled",
Value: func() unsafe.Pointer {
i := 123
return unsafe.Pointer(&i) //nolint:gosec // It's OK.
}(),
ConfigureWriter: func(vw *CommonWriter) {
vw.Support = nil
},
IgnoreResult: true,
},
{
Name: "Not",
Value: "test",
ConfigureWriter: func(vw *CommonWriter) {
vw.ValueWriters = ValueWriters{vw.Kind.UnsafePointer}
},
IgnoreBenchmark: true,
},
})
}