dodgifyMsgpString will wreck the nth string in the msgpack blob so that it raises an error when decoded or unmarshaled.
(bts []byte, idx int)
| 98 | // dodgifyMsgpString will wreck the nth string in the msgpack blob |
| 99 | // so that it raises an error when decoded or unmarshaled. |
| 100 | func dodgifyMsgpString(bts []byte, idx int) []byte { |
| 101 | r := msgp.NewReader(bytes.NewReader(bts)) |
| 102 | out := &dodgifierBuf{Buffer: &bytes.Buffer{}, dodgifyString: idx} |
| 103 | for { |
| 104 | _, err := r.CopyNext(out) |
| 105 | if err == io.EOF { |
| 106 | break |
| 107 | } else if err != nil { |
| 108 | panic(err) |
| 109 | } |
| 110 | } |
| 111 | return out.Bytes() |
| 112 | } |
| 113 | |
| 114 | func TestErrorCtxAsMapUnmarshal(t *testing.T) { |
| 115 | bts := marshalErrorCtx(fillErrorCtxAsMap()) |
no test coverage detected
searching dependent graphs…