(t *testing.T)
| 294 | } |
| 295 | |
| 296 | func TestMergeValuesCLI(t *testing.T) { |
| 297 | tests := []struct { |
| 298 | name string |
| 299 | opts Options |
| 300 | expected map[string]any |
| 301 | wantErr bool |
| 302 | }{ |
| 303 | { |
| 304 | name: "set-json object", |
| 305 | opts: Options{ |
| 306 | JSONValues: []string{`{"foo": {"bar": "baz"}}`}, |
| 307 | }, |
| 308 | expected: map[string]any{ |
| 309 | "foo": map[string]any{ |
| 310 | "bar": "baz", |
| 311 | }, |
| 312 | }, |
| 313 | }, |
| 314 | { |
| 315 | name: "set-json key=value", |
| 316 | opts: Options{ |
| 317 | JSONValues: []string{"foo.bar=[1,2,3]"}, |
| 318 | }, |
| 319 | expected: map[string]any{ |
| 320 | "foo": map[string]any{ |
| 321 | "bar": []any{1.0, 2.0, 3.0}, |
| 322 | }, |
| 323 | }, |
| 324 | }, |
| 325 | { |
| 326 | name: "set regular value", |
| 327 | opts: Options{ |
| 328 | Values: []string{"foo=bar"}, |
| 329 | }, |
| 330 | expected: map[string]any{ |
| 331 | "foo": "bar", |
| 332 | }, |
| 333 | }, |
| 334 | { |
| 335 | name: "set string value", |
| 336 | opts: Options{ |
| 337 | StringValues: []string{"foo=123"}, |
| 338 | }, |
| 339 | expected: map[string]any{ |
| 340 | "foo": "123", |
| 341 | }, |
| 342 | }, |
| 343 | { |
| 344 | name: "set literal value", |
| 345 | opts: Options{ |
| 346 | LiteralValues: []string{"foo=true"}, |
| 347 | }, |
| 348 | expected: map[string]any{ |
| 349 | "foo": "true", |
| 350 | }, |
| 351 | }, |
| 352 | { |
| 353 | name: "multiple options", |
nothing calls this directly
no test coverage detected
searching dependent graphs…