func Test_BytesBox_Write(t *testing.T) { data := []byte{0x9f, 0x37, 0xe1, 0xe, 0x4, 0x74, 0x65, 0x73, 0x74, 0x0, 0x0, 0x0} i := builtin.NewBytes([]byte("test")) var buff = new(bytes.Buffer) proto := bin.NewEncoder(buff) assert.NoError(t, i.Box().Write(proto)) assert.Equal(t, data, buff.Bytes()) }
func Test_BytesBoxRead(t *testing.T) { data := []byte{0x9f, 0x37, 0xe1, 0xe, 0x4, 0x74, 0x65, 0x73, 0x74, 0x0, 0x0, 0x0} val := builtin.NewBytes([]byte("test")) proto := bin.NewDecoder(bytes.NewBuffer(data)) res := (&builtin.Bytes{}).Box() assert.NoError(t, res.Read(proto, nil, uuid.UUID{})) assert.Equal(t, val, res.Strip()) }
func Test_Bytes_Unwrap(t *testing.T) { i := builtin.NewBytes([]byte("test")) res := i.Strip().([]byte) assert.Equal(t, []byte("test"), res) }