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

Function TestUnmarshalMap

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

Source from the content-addressed store, hash-verified

62}
63
64func TestUnmarshalMap(t *testing.T) {
65 input := []byte(`
66 { "M":
67 {
68 "Name": { "S": "Joe" },
69 "Age": { "N": "35" }
70 }
71 }`)
72
73 var av DynamoDBAttributeValue
74 err := json.Unmarshal(input, &av)
75
76 assert.Nil(t, err)
77 assert.Equal(t, DataTypeMap, av.DataType())
78 assert.Equal(t, 2, len(av.Map()))
79 assert.Equal(t, "Joe", av.Map()["Name"].String())
80 assert.Equal(t, "35", av.Map()["Age"].Number())
81}
82
83func TestUnmarshalNumber(t *testing.T) {
84 input := []byte(`{ "N": "123.45"}`)

Callers

nothing calls this directly

Calls 4

DataTypeMethod · 0.95
MapMethod · 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…