Merge pull request #537 from nspcc-dev/feature/unit_binaryWrite

io: add missing test
This commit is contained in:
Roman Khimov 2019-12-03 17:40:29 +03:00 committed by GitHub
commit bb5aba8f95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -200,6 +200,18 @@ func TestWriteVarUint100000000000(t *testing.T) {
assert.Equal(t, val, res)
}
func TestWriteBytes(t *testing.T) {
var (
bin = []byte{0xde, 0xad, 0xbe, 0xef}
)
bw := NewBufBinWriter()
bw.WriteBytes(bin)
assert.Nil(t, bw.Err)
buf := bw.Bytes()
assert.Equal(t, 4, len(buf))
assert.Equal(t, byte(0xde), buf[0])
}
type testSerializable uint16
// EncodeBinary implements io.Serializable interface.