(t *testing.T)
| 332 | } |
| 333 | |
| 334 | func TestNonStringKeys(t *testing.T) { |
| 335 | // FIXME(thaJeztah): opkg.in/yaml.v3, which always unmarshals to a map[string]any, so we cannot produce a customized error for invalid types. |
| 336 | t.Skip("not supported by go.yaml.in/yaml/v3, which always unmarshals to a map[string]any") |
| 337 | _, err := loadYAML(` |
| 338 | version: "3" |
| 339 | 123: |
| 340 | foo: |
| 341 | image: busybox |
| 342 | `) |
| 343 | assert.Check(t, is.ErrorContains(err, "non-string key at top level: 123")) |
| 344 | |
| 345 | _, err = loadYAML(` |
| 346 | version: "3" |
| 347 | services: |
| 348 | foo: |
| 349 | image: busybox |
| 350 | 123: |
| 351 | image: busybox |
| 352 | `) |
| 353 | assert.Check(t, is.ErrorContains(err, "non-string key in services: 123")) |
| 354 | |
| 355 | _, err = loadYAML(` |
| 356 | version: "3" |
| 357 | services: |
| 358 | foo: |
| 359 | image: busybox |
| 360 | networks: |
| 361 | default: |
| 362 | ipam: |
| 363 | config: |
| 364 | - 123: oh dear |
| 365 | `) |
| 366 | assert.Check(t, is.ErrorContains(err, "non-string key in networks.default.ipam.config[0]: 123")) |
| 367 | |
| 368 | _, err = loadYAML(` |
| 369 | version: "3" |
| 370 | services: |
| 371 | dict-env: |
| 372 | image: busybox |
| 373 | environment: |
| 374 | 1: FOO |
| 375 | `) |
| 376 | assert.Check(t, is.ErrorContains(err, "non-string key in services.dict-env.environment: 1")) |
| 377 | } |
| 378 | |
| 379 | func TestSupportedVersion(t *testing.T) { |
| 380 | _, err := loadYAML(` |
nothing calls this directly
no test coverage detected
searching dependent graphs…