TestValuesString tests Values.String function
(t *testing.T)
| 790 | |
| 791 | // TestValuesString tests Values.String function |
| 792 | func TestValuesString(t *testing.T) { |
| 793 | type testData struct { |
| 794 | v Values // Input Values |
| 795 | s string // Expected output |
| 796 | } |
| 797 | |
| 798 | tests := []testData{ |
| 799 | { |
| 800 | v: nil, |
| 801 | s: "[]", |
| 802 | }, |
| 803 | |
| 804 | { |
| 805 | v: Values{}, |
| 806 | s: "[]", |
| 807 | }, |
| 808 | |
| 809 | { |
| 810 | v: Values{{TagInteger, Integer(5)}}, |
| 811 | s: "5", |
| 812 | }, |
| 813 | |
| 814 | { |
| 815 | v: Values{{TagInteger, Integer(5)}, {TagEnum, Integer(6)}}, |
| 816 | s: "[5,6]", |
| 817 | }, |
| 818 | } |
| 819 | |
| 820 | for _, test := range tests { |
| 821 | s := test.v.String() |
| 822 | if s != test.s { |
| 823 | t.Errorf("testing Values.String:\n"+ |
| 824 | "value: %#v\n"+ |
| 825 | "expected: %q\n"+ |
| 826 | "present: %q\n", |
| 827 | test.v, test.s, s, |
| 828 | ) |
| 829 | } |
| 830 | } |
| 831 | } |
| 832 | |
| 833 | // TestValuesEqualSimilar tests Values.Equal and Values.Similar |
| 834 | func TestValuesEqualSimilar(t *testing.T) { |