MCPcopy
hub / github.com/aws/aws-lambda-go / TestUnmarshalList

Function TestUnmarshalList

events/attributevalue_test.go:47–62  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

45}
46
47func TestUnmarshalList(t *testing.T) {
48 input := []byte(`{ "L": [
49 { "S": "Cookies"},
50 { "S": "Coffee"},
51 { "N": "3.14159" }
52 ] }`)
53
54 var av DynamoDBAttributeValue
55 err := json.Unmarshal(input, &av)
56
57 assert.Nil(t, err)
58 assert.Equal(t, DataTypeList, av.DataType())
59 assert.Equal(t, 3, len(av.List()))
60 assert.Equal(t, "Cookies", av.List()[0].String())
61 assert.Equal(t, "3.14159", av.List()[2].Number())
62}
63
64func TestUnmarshalMap(t *testing.T) {
65 input := []byte(`

Callers

nothing calls this directly

Calls 4

DataTypeMethod · 0.95
ListMethod · 0.95
NumberMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…