Commit 65d6314e authored by Kirill Smelkov's avatar Kirill Smelkov Committed by Kamil Kisiel

fuzz: Add more details when reporting failures

Should be better in 302c79ea (fuzz: Hook encoder into the loop), but it
is hopefully never too late.
parent bd5a7fd4
...@@ -36,14 +36,15 @@ func Fuzz(data []byte) int { ...@@ -36,14 +36,15 @@ func Fuzz(data []byte) int {
if proto == 0 && err == errP0PersIDStringLineOnly { if proto == 0 && err == errP0PersIDStringLineOnly {
continue continue
} }
panic(err) panic(fmt.Sprintf("protocol %d: encode error: %s", proto, err))
} }
encoded := buf.String()
dec = NewDecoder(buf) dec = NewDecoder(bytes.NewStringReader(encoded))
obj2, err := dec.Decode() obj2, err := dec.Decode()
if err != nil { if err != nil {
// must succeed, as buf should contain valid pickle from encoder // must succeed, as buf should contain valid pickle from encoder
panic(err) panic(fmt.Sprintf("protocol %d: decode back error: err\npickle: %q", proto, encoded)
} }
if !reflect.DeepEqual(obj, obj2) { if !reflect.DeepEqual(obj, obj2) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment