You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.2 KiB

package _generated
import (
"bytes"
"testing"
"github.com/tinylib/msgp/msgp"
)
func TestConvertFromEncodeError(t *testing.T) {
e := ConvertErr{ConvertErrVal(fromFailStr)}
var buf bytes.Buffer
w := msgp.NewWriter(&buf)
err := e.EncodeMsg(w)
if err != errConvertFrom {
t.Fatalf("expected conversion error, found %v", err.Error())
}
}
func TestConvertToEncodeError(t *testing.T) {
var in, out ConvertErr
in = ConvertErr{ConvertErrVal(toFailStr)}
var buf bytes.Buffer
w := msgp.NewWriter(&buf)
err := in.EncodeMsg(w)
if err != nil {
t.FailNow()
}
w.Flush()
r := msgp.NewReader(&buf)
err = (&out).DecodeMsg(r)
if err != errConvertTo {
t.Fatalf("expected conversion error, found %v", err.Error())
}
}
func TestConvertFromMarshalError(t *testing.T) {
e := ConvertErr{ConvertErrVal(fromFailStr)}
var b []byte
_, err := e.MarshalMsg(b)
if err != errConvertFrom {
t.Fatalf("expected conversion error, found %v", err.Error())
}
}
func TestConvertToMarshalError(t *testing.T) {
var in, out ConvertErr
in = ConvertErr{ConvertErrVal(toFailStr)}
b, err := in.MarshalMsg(nil)
if err != nil {
t.FailNow()
}
_, err = (&out).UnmarshalMsg(b)
if err != errConvertTo {
t.Fatalf("expected conversion error, found %v", err.Error())
}
}