MCPcopy Index your code
hub / github.com/tinylib/msgp / TestConvertToEncodeError

Function TestConvertToEncodeError

_generated/convert_test.go:20–37  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

18}
19
20func TestConvertToEncodeError(t *testing.T) {
21 var in, out ConvertErr
22 in = ConvertErr{ConvertErrVal(toFailStr)}
23 var buf bytes.Buffer
24 w := msgp.NewWriter(&buf)
25 err := in.EncodeMsg(w)
26 if err != nil {
27 t.FailNow()
28 }
29 w.Flush()
30
31 r := msgp.NewReader(&buf)
32 err = (&out).DecodeMsg(r)
33
34 if msgp.Cause(err) != errConvertTo {
35 t.Fatalf("expected conversion error, found %v", err.Error())
36 }
37}
38
39func TestConvertFromMarshalError(t *testing.T) {
40 e := ConvertErr{ConvertErrVal(fromFailStr)}

Callers

nothing calls this directly

Calls 8

FlushMethod · 0.95
NewWriterFunction · 0.92
NewReaderFunction · 0.92
CauseFunction · 0.92
ConvertErrValTypeAlias · 0.85
EncodeMsgMethod · 0.65
DecodeMsgMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…