MCPcopy Create free account
hub / github.com/aws/smithy-go / TestEncode_String

Function TestEncode_String

encoding/cbor/encode_test.go:152–173  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

150}
151
152func TestEncode_String(t *testing.T) {
153 for name, c := range map[string]struct {
154 Expect []byte
155 In Value
156 }{
157 "len = 0": {
158 []byte{3<<5 | 0},
159 String(""),
160 },
161 "len > 0": {
162 []byte{3<<5 | 3, 0x66, 0x6f, 0x6f},
163 String("foo"),
164 },
165 } {
166 t.Run(name, func(t *testing.T) {
167 actual := Encode(c.In)
168 if !bytes.Equal(c.Expect, actual) {
169 t.Errorf("bytes not equal (%s != %s)", hex.EncodeToString(c.Expect), hex.EncodeToString(actual))
170 }
171 })
172 }
173}
174
175func TestEncode_List(t *testing.T) {
176 for name, c := range map[string]struct {

Callers

nothing calls this directly

Calls 3

EncodeFunction · 0.85
ErrorfMethod · 0.80
StringTypeAlias · 0.70

Tested by

no test coverage detected