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

Function TestSetGet

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

Source from the content-addressed store, hash-verified

17}
18
19func TestSetGet(t *testing.T) {
20 m := orderedmap.NewMap()
21 m.Set("a", 1)
22
23 v, ok := m.Get("a")
24 if !ok {
25 t.Fatal("expected key a to exist")
26 }
27 if v != 1 {
28 t.Fatalf("expected 1, got %v", v)
29 }
30
31 // Missing key.
32 _, ok = m.Get("missing")
33 if ok {
34 t.Fatal("expected key missing to not exist")
35 }
36}
37
38func TestSetOverwrite(t *testing.T) {
39 m := orderedmap.NewMap()

Callers

nothing calls this directly

Calls 3

SetMethod · 0.95
GetMethod · 0.95
NewMapFunction · 0.92

Tested by

no test coverage detected