add test case

Signed-off-by: zwwhdls <zwwhdls@hotmail.com>
pull/7184/head
zwwhdls 5 years ago
parent 5396df2e28
commit c41c72cee9

@ -427,7 +427,7 @@ func TestParseInto(t *testing.T) {
"inner2": "value2", "inner2": "value2",
}, },
} }
input := "outer.inner1=value1,outer.inner3=value3,outer.inner4=4" input := "outer.inner1=value1,outer.inner3=value3,outer.inner4=4,listOuter[0][0].type=listValue"
expect := map[string]interface{}{ expect := map[string]interface{}{
"outer": map[string]interface{}{ "outer": map[string]interface{}{
"inner1": "value1", "inner1": "value1",
@ -435,12 +435,22 @@ func TestParseInto(t *testing.T) {
"inner3": "value3", "inner3": "value3",
"inner4": 4, "inner4": 4,
}, },
"listOuter": [][]interface{}{{map[string]string{
"type": "listValue",
"status": "alive",
}},
},
} }
if err := ParseInto(input, got); err != nil { if err := ParseInto(input, got); err != nil {
t.Fatal(err) t.Fatal(err)
} }
input2 := "listOuter[0][0].status=alive"
if err := ParseInto(input2, got); err != nil {
t.Fatal(err)
}
y1, err := yaml.Marshal(expect) y1, err := yaml.Marshal(expect)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)

Loading…
Cancel
Save