(t *testing.T)
| 584 | } |
| 585 | |
| 586 | func TestObject_InList(t *testing.T) { |
| 587 | t.Run("basic", func(t *testing.T) { |
| 588 | cases := []struct { |
| 589 | name string |
| 590 | value map[string]interface{} |
| 591 | testList []interface{} |
| 592 | wantEqual chainResult |
| 593 | }{ |
| 594 | { |
| 595 | name: "empty vs empty", |
| 596 | value: map[string]interface{}{}, |
| 597 | testList: []interface{}{ |
| 598 | map[string]interface{}{}, |
| 599 | }, |
| 600 | wantEqual: success, |
| 601 | }, |
| 602 | { |
| 603 | name: "different key", |
| 604 | value: map[string]interface{}{"foo": 123.0}, |
| 605 | testList: []interface{}{ |
| 606 | map[string]interface{}{"FOO": 123.0}, |
| 607 | map[string]interface{}{"BAR": 456.0}, |
| 608 | }, |
| 609 | wantEqual: failure, |
| 610 | }, |
| 611 | { |
| 612 | name: "different key or value", |
| 613 | value: map[string]interface{}{"foo": 123.0}, |
| 614 | testList: []interface{}{ |
| 615 | map[string]interface{}{"foo": 456.0}, |
| 616 | map[string]interface{}{"bar": 123.0}, |
| 617 | }, |
| 618 | wantEqual: failure, |
| 619 | }, |
| 620 | { |
| 621 | name: "success", |
| 622 | value: map[string]interface{}{"foo": 123.0}, |
| 623 | testList: []interface{}{ |
| 624 | map[string]interface{}{"foo": 123.0}, |
| 625 | map[string]interface{}{"bar": 456.0}, |
| 626 | }, |
| 627 | wantEqual: success, |
| 628 | }, |
| 629 | { |
| 630 | name: "struct", |
| 631 | value: map[string]interface{}{"foo": 123.0}, |
| 632 | testList: []interface{}{ |
| 633 | struct { |
| 634 | Foo float64 `json:"foo"` |
| 635 | }{ |
| 636 | Foo: 123.00, |
| 637 | }, |
| 638 | }, |
| 639 | wantEqual: success, |
| 640 | }, |
| 641 | } |
| 642 | |
| 643 | for _, tc := range cases { |
nothing calls this directly
no test coverage detected
searching dependent graphs…