MCPcopy Create free account
hub / github.com/aws-cloudformation/rain / TestRemoveFromMap

Function TestRemoveFromMap

internal/node/node_test.go:129–169  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

127}
128
129func TestRemoveFromMap(t *testing.T) {
130
131 m := &yaml.Node{
132 Kind: yaml.MappingNode,
133 Content: make([]*yaml.Node, 4),
134 }
135
136 m.Content[0] = &yaml.Node{
137 Kind: yaml.ScalarNode,
138 Value: "KeepKey",
139 }
140
141 m.Content[1] = &yaml.Node{
142 Kind: yaml.ScalarNode,
143 Value: "KeepVal",
144 }
145
146 m.Content[2] = &yaml.Node{
147 Kind: yaml.ScalarNode,
148 Value: "RemoveKey",
149 }
150
151 m.Content[3] = &yaml.Node{
152 Kind: yaml.ScalarNode,
153 Value: "RemoveVal",
154 }
155
156 err := node.RemoveFromMap(m, "RemoveKey")
157 if err != nil {
158 t.Error(err)
159 }
160
161 if len(m.Content) != 2 {
162 t.Errorf("m.Content len is %v", len(m.Content))
163 }
164
165 if m.Content[0].Value != "KeepKey" && m.Content[1].Value != "KeepVal" {
166 t.Errorf("m.Content[0] is %v, [1] is %v", m.Content[0].Value, m.Content[1].Value)
167 }
168
169}
170
171func TestSetMapValue(t *testing.T) {
172 n := &yaml.Node{Kind: yaml.MappingNode, Content: make([]*yaml.Node, 0)}

Callers

nothing calls this directly

Calls 1

RemoveFromMapFunction · 0.92

Tested by

no test coverage detected