MCPcopy
hub / github.com/TomWright/dasel / TestDelete

Function TestDelete

model/orderedmap/map_test.go:53–70  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

51}
52
53func TestDelete(t *testing.T) {
54 m := orderedmap.NewMap()
55 m.Set("a", 1)
56 m.Set("b", 2)
57 m.Delete("a")
58
59 _, ok := m.Get("a")
60 if ok {
61 t.Fatal("expected key a to be deleted")
62 }
63 if m.Len() != 1 {
64 t.Fatalf("expected Len 1, got %d", m.Len())
65 }
66 keys := m.Keys()
67 if len(keys) != 1 || keys[0] != "b" {
68 t.Fatalf("expected keys [b], got %v", keys)
69 }
70}
71
72func TestDeleteNonExistent(t *testing.T) {
73 m := orderedmap.NewMap()

Callers

nothing calls this directly

Calls 6

SetMethod · 0.95
DeleteMethod · 0.95
GetMethod · 0.95
LenMethod · 0.95
KeysMethod · 0.95
NewMapFunction · 0.92

Tested by

no test coverage detected