mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-28 01:41:48 -06:00
25 lines
369 B
Go
25 lines
369 B
Go
|
package flatmap
|
||
|
|
||
|
import (
|
||
|
"reflect"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestMapDelete(t *testing.T) {
|
||
|
m := Flatten(map[string]interface{}{
|
||
|
"foo": "bar",
|
||
|
"routes": []map[string]string{
|
||
|
map[string]string{
|
||
|
"foo": "bar",
|
||
|
},
|
||
|
},
|
||
|
})
|
||
|
|
||
|
m.Delete("routes")
|
||
|
|
||
|
expected := Map(map[string]string{"foo": "bar"})
|
||
|
if !reflect.DeepEqual(m, expected) {
|
||
|
t.Fatalf("bad: %#v", m)
|
||
|
}
|
||
|
}
|