(t *testing.T)
| 793 | } |
| 794 | |
| 795 | func TestObjectIsCompatible(t *testing.T) { |
| 796 | var ( |
| 797 | b = true |
| 798 | i = 1 |
| 799 | s = struct { |
| 800 | Foo string |
| 801 | }{ |
| 802 | Foo: "foo", |
| 803 | } |
| 804 | m = map[int]string{} |
| 805 | ) |
| 806 | cases := map[string]struct { |
| 807 | values []any |
| 808 | expected bool |
| 809 | }{ |
| 810 | "compatible": { |
| 811 | values: []any{s, m}, |
| 812 | expected: true, |
| 813 | }, |
| 814 | "not comatible": { |
| 815 | values: []any{b, i}, |
| 816 | expected: false, |
| 817 | }, |
| 818 | } |
| 819 | |
| 820 | object := Object{} |
| 821 | for k, tc := range cases { |
| 822 | for _, value := range tc.values { |
| 823 | if actual := object.IsCompatible(value); tc.expected != actual { |
| 824 | t.Errorf("%s: got %#v, expected %#v", k, actual, tc.expected) |
| 825 | } |
| 826 | } |
| 827 | } |
| 828 | } |
| 829 | |
| 830 | func TestMapIsCompatible(t *testing.T) { |
| 831 | var ( |
nothing calls this directly
no test coverage detected