MCPcopy
hub / github.com/cortexlabs/cortex / TestInterfaceList

Function TestInterfaceList

pkg/lib/configreader/reader_test.go:501–595  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

499}
500
501func TestInterfaceList(t *testing.T) {
502 structValidation := &StructValidation{
503 StructFieldValidations: []*StructFieldValidation{
504 {
505 // Key: "typeds",
506 StructField: "Typeds",
507 InterfaceStructListValidation: &InterfaceStructListValidation{
508 InterfaceStructValidation: _interfaceStructValidation,
509 },
510 },
511 },
512 }
513
514 configData := MustReadYAMLStr(
515 `
516 typeds:
517 - type: type1
518 key0: testA
519 key1: testB
520
521 - type: type2
522 keyA: 0
523 keyB: 1
524
525 - type: type1
526 key0: test1
527 key1: test2
528
529 - type: type2
530 keyA: 0
531 keyB: -1
532 `)
533
534 expected := &TypedListConfig{
535 Typeds: []Typed{
536 &Typed1{
537 Key0: "testA",
538 Key1: "testB",
539 },
540 &Typed2{
541 KeyA: 0,
542 KeyB: 1,
543 },
544 &Typed1{
545 Key0: "test1",
546 Key1: "test2",
547 },
548 &Typed2{
549 KeyA: 0,
550 KeyB: -1,
551 },
552 },
553 }
554
555 testConfig(structValidation, configData, expected, t)
556
557 structValidation = &StructValidation{
558 StructFieldValidations: []*StructFieldValidation{

Callers

nothing calls this directly

Calls 2

MustReadYAMLStrFunction · 0.85
testConfigFunction · 0.85

Tested by

no test coverage detected