| 177 | } |
| 178 | |
| 179 | func 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 | |
| 202 | func TestMapKeyValues(t *testing.T) { |
| 203 | m := model.NewValue(orderedmap.NewMap().Set("a", "one").Set("b", "two")) |