(t *testing.T)
| 91 | } |
| 92 | |
| 93 | func TestMessagePackCodec_Encode(t *testing.T) { |
| 94 | type TestStruct struct { |
| 95 | Field1 string |
| 96 | Field2 int |
| 97 | } |
| 98 | assert := assert.New(t) |
| 99 | |
| 100 | codec := &MessagePackCodec{ |
| 101 | MsgPack: NewMsgPackHandle(), |
| 102 | } |
| 103 | |
| 104 | t.Run("successful encoding", func(t *testing.T) { |
| 105 | testStruct := &TestStruct{ |
| 106 | Field1: "Test", |
| 107 | Field2: 1, |
| 108 | } |
| 109 | outStruct := &TestStruct{} |
| 110 | |
| 111 | b, err := codec.Encode(testStruct) |
| 112 | assert.Nil(err, "Error should be nil") |
| 113 | err = codec.Decode(b, outStruct) |
| 114 | assert.NoError(err) |
| 115 | assert.EqualValues(testStruct, outStruct) |
| 116 | }) |
| 117 | |
| 118 | } |
| 119 | func TestEncodeString(t *testing.T) { |
| 120 | tests := []struct { |
| 121 | input string |
nothing calls this directly
no test coverage detected