MCPcopy Create free account
hub / github.com/containerd/nerdctl / TestZeroMapValues

Function TestZeroMapValues

pkg/containerutil/container_network_manager_test.go:26–117  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

24)
25
26func TestZeroMapValues(t *testing.T) {
27 emptyString := ""
28 testCases := []struct {
29 key string
30 value interface{}
31 shouldBeZero bool
32 }{
33 {
34 key: "false",
35 value: false,
36 shouldBeZero: true,
37 },
38 {
39 key: "true",
40 value: true,
41 shouldBeZero: false,
42 },
43 {
44 key: "zeroInt",
45 value: int(0),
46 shouldBeZero: true,
47 },
48 {
49 key: "nonZeroInt",
50 value: int(1),
51 shouldBeZero: false,
52 },
53 {
54 key: "zeroString",
55 value: "",
56 shouldBeZero: true,
57 },
58 {
59 key: "nonZeroString",
60 value: "non-zero",
61 shouldBeZero: false,
62 },
63 {
64 key: "nilPointer",
65 value: (*string)(nil),
66 shouldBeZero: true,
67 },
68 {
69 key: "pointerToEmpty",
70 value: &emptyString,
71 // technically just a nil pointer check, so any value should be non-Zero:
72 shouldBeZero: false,
73 },
74 {
75 key: "nilSlice",
76 value: []string(nil),
77 shouldBeZero: true,
78 },
79 {
80 key: "emptySlice",
81 value: []string{},
82 shouldBeZero: false,
83 },

Callers

nothing calls this directly

Calls 2

nonZeroMapValuesFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…