(t *testing.T)
| 110 | } |
| 111 | |
| 112 | func TestObjectsAndObjectValues(t *testing.T) { |
| 113 | t.Parallel() |
| 114 | |
| 115 | tests := []struct { |
| 116 | desc string |
| 117 | give Field |
| 118 | want []any |
| 119 | }{ |
| 120 | { |
| 121 | desc: "Objects/nil slice", |
| 122 | give: Objects[*emptyObject]("", nil), |
| 123 | want: []any{}, |
| 124 | }, |
| 125 | { |
| 126 | desc: "ObjectValues/nil slice", |
| 127 | give: ObjectValues[emptyObject]("", nil), |
| 128 | want: []any{}, |
| 129 | }, |
| 130 | { |
| 131 | desc: "ObjectValues/empty slice", |
| 132 | give: ObjectValues("", []emptyObject{}), |
| 133 | want: []any{}, |
| 134 | }, |
| 135 | { |
| 136 | desc: "ObjectValues/single item", |
| 137 | give: ObjectValues("", []emptyObject{ |
| 138 | {}, |
| 139 | }), |
| 140 | want: []any{ |
| 141 | map[string]any{}, |
| 142 | }, |
| 143 | }, |
| 144 | { |
| 145 | desc: "Objects/multiple different objects", |
| 146 | give: Objects("", []*fakeObject{ |
| 147 | {value: "foo"}, |
| 148 | {value: "bar"}, |
| 149 | {value: "baz"}, |
| 150 | }), |
| 151 | want: []any{ |
| 152 | map[string]any{"value": "foo"}, |
| 153 | map[string]any{"value": "bar"}, |
| 154 | map[string]any{"value": "baz"}, |
| 155 | }, |
| 156 | }, |
| 157 | { |
| 158 | desc: "ObjectValues/multiple different objects", |
| 159 | give: ObjectValues("", []fakeObject{ |
| 160 | {value: "foo"}, |
| 161 | {value: "bar"}, |
| 162 | {value: "baz"}, |
| 163 | }), |
| 164 | want: []any{ |
| 165 | map[string]any{"value": "foo"}, |
| 166 | map[string]any{"value": "bar"}, |
| 167 | map[string]any{"value": "baz"}, |
| 168 | }, |
| 169 | }, |
nothing calls this directly
no test coverage detected