(t *testing.T)
| 24 | ) |
| 25 | |
| 26 | func 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 | }, |
nothing calls this directly
no test coverage detected
searching dependent graphs…