func Test_StringBox_Write(t *testing.T) { data := []byte{0x24, 0x6e, 0x28, 0xb5, 0x4, 0x74, 0x65, 0x73, 0x74, 0x0, 0x0, 0x0} i := builtin.NewString("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_StringBoxRead(t *testing.T) { data := []byte{0x24, 0x6e, 0x28, 0xb5, 0x4, 0x74, 0x65, 0x73, 0x74, 0x0, 0x0, 0x0} val := builtin.NewString("test") proto := bin.NewDecoder(bytes.NewBuffer(data)) res := (&builtin.String{}).Box() assert.NoError(t, res.Read(proto, nil, uuid.UUID{})) assert.Equal(t, val, res.Strip()) }
func Test_String_Value(t *testing.T) { i := builtin.NewString("test") res := i.Strip() assert.Equal(t, string("test"), res) }