MCPcopy Index your code
hub / github.com/TomWright/dasel / TestMapKeyExists

Function TestMapKeyExists

model/value_map_test.go:179–200  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

177}
178
179func TestMapKeyExists(t *testing.T) {
180 m := model.NewValue(orderedmap.NewMap().Set("exists", "val"))
181
182 t.Run("existing key", func(t *testing.T) {
183 ok, err := m.MapKeyExists("exists")
184 if err != nil {
185 t.Fatal(err)
186 }
187 if !ok {
188 t.Error("expected key to exist")
189 }
190 })
191 t.Run("missing key", func(t *testing.T) {
192 ok, err := m.MapKeyExists("missing")
193 if err != nil {
194 t.Fatal(err)
195 }
196 if ok {
197 t.Error("expected key to not exist")
198 }
199 })
200}
201
202func TestMapKeyValues(t *testing.T) {
203 m := model.NewValue(orderedmap.NewMap().Set("a", "one").Set("b", "two"))

Callers

nothing calls this directly

Calls 6

MapKeyExistsMethod · 0.95
NewValueFunction · 0.92
NewMapFunction · 0.92
SetMethod · 0.45
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected