better test message for failure to convert x to y

This commit is contained in:
idk 2018-11-27 12:57:08 -05:00
parent 01a9048ee5
commit fb27f336e7
No known key found for this signature in database
GPG Key ID: D75C03B39B5E14E1

View File

@ -185,11 +185,11 @@ func TestStringToBytes(t *testing.T) {
b2, err := stringToBytes(s) b2, err := stringToBytes(s)
if err != nil { if err != nil {
t.Error("failed to convert\n\t", s, err) t.Error("failed to convert", s, err)
} }
if !bytes.Equal(b1, b2) { if !bytes.Equal(b1, b2) {
t.Error("failed to convert stb\n\t", s, "to\n\t", b1, "\ngot\n\t", b2) t.Error("failed to convert ", s, "to", b1, "got", b2)
} }
if err := validateBytes(b2); err != nil { if err := validateBytes(b2); err != nil {
@ -224,11 +224,11 @@ func TestBytesToString(t *testing.T) {
s2, err := bytesToString(b) s2, err := bytesToString(b)
if err != nil { if err != nil {
t.Error("failed to convert\n\t", b, err) t.Error("failed to convert", b, err)
} }
if s1 != s2 { if s1 != s2 {
t.Error("failed to convert\n\t", b, "\nto\n\t", s1, "\ngot\n\t", s2) t.Error("failed to convert", b, "to", s1, "got", s2)
} }
} }