MCPcopy Create free account
hub / github.com/OpenPrinting/goipp / TestValuesString

Function TestValuesString

value_test.go:792–831  ·  view source on GitHub ↗

TestValuesString tests Values.String function

(t *testing.T)

Source from the content-addressed store, hash-verified

790
791// TestValuesString tests Values.String function
792func 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
834func TestValuesEqualSimilar(t *testing.T) {

Callers

nothing calls this directly

Calls 2

IntegerTypeAlias · 0.85
StringMethod · 0.65

Tested by

no test coverage detected