(t *testing.T)
| 191 | func (svs *staticValueSource) Lookup() (string, bool) { return svs.v, true } |
| 192 | |
| 193 | func TestMapValueSource(t *testing.T) { |
| 194 | tests := []struct { |
| 195 | name string |
| 196 | m map[any]any |
| 197 | key string |
| 198 | val string |
| 199 | found bool |
| 200 | }{ |
| 201 | { |
| 202 | name: "No map no key", |
| 203 | }, |
| 204 | { |
| 205 | name: "No map with key", |
| 206 | key: "foo", |
| 207 | }, |
| 208 | { |
| 209 | name: "Empty map no key", |
| 210 | m: map[any]any{}, |
| 211 | }, |
| 212 | { |
| 213 | name: "Empty map with key", |
| 214 | key: "foo", |
| 215 | m: map[any]any{}, |
| 216 | }, |
| 217 | { |
| 218 | name: "Level 1 no key", |
| 219 | key: ".foob", |
| 220 | m: map[any]any{ |
| 221 | "foo": 10, |
| 222 | }, |
| 223 | }, |
| 224 | { |
| 225 | name: "Level 1", |
| 226 | key: "foobar", |
| 227 | m: map[any]any{ |
| 228 | "foobar": 10, |
| 229 | }, |
| 230 | val: "10", |
| 231 | found: true, |
| 232 | }, |
| 233 | { |
| 234 | name: "Level 2", |
| 235 | key: "foo.bar", |
| 236 | m: map[any]any{ |
| 237 | "foo": map[any]any{ |
| 238 | "bar": 10, |
| 239 | }, |
| 240 | }, |
| 241 | val: "10", |
| 242 | found: true, |
| 243 | }, |
| 244 | { |
| 245 | name: "Level 2 invalid key", |
| 246 | key: "foo.bar1", |
| 247 | m: map[any]any{ |
| 248 | "foo": map[any]any{ |
| 249 | "bar": "10", |
| 250 | }, |
nothing calls this directly
no test coverage detected