Example #1
0
func TestDecodeErrors(t *testing.T) {
	for _, test := range decodeTests {
		_, err := lich.Decode(test.input)
		if (err != nil) != test.err {
			t.Errorf("Decode(%v).err = %v", test.input, err)
		}
	}
}
Example #2
0
func TestDecodeRoundTrip(t *testing.T) {
	for _, test := range decodeTests {
		if test.err {
			continue
		}
		el, err := lich.Decode(test.input)
		if err != nil {
			t.Errorf("Decode(%v).err = %v", test.input, err)
		}
		if el == nil {
			t.Errorf("Decode(%v) = %v", test.input, el)
		}
		if el.String() != test.input {
			t.Errorf("Decode(%v) = %v", test.input, el)
		}
	}
}