1
0
Fork 0

fix: boolean flag parsing with map.

This commit is contained in:
Ludovic Fernandez 2019-09-13 19:10:04 +02:00 committed by Traefiker Bot
parent b55be9fdea
commit b4c7b90c9e
2 changed files with 39 additions and 4 deletions

View file

@ -250,7 +250,7 @@ func TestParse(t *testing.T) {
},
},
{
desc: "map struct with sub-map case senstitive",
desc: "map struct with sub-map case sensitive",
args: []string{"--foo.Name1.bar.name2.value=firstValue", "--foo.naMe1.bar.name2.value=secondValue"},
element: &struct {
Foo map[string]struct {
@ -273,6 +273,20 @@ func TestParse(t *testing.T) {
"traefik.foo.Name1.bar.name2.value": "secondValue",
},
},
{
desc: "pointer of struct and map without explicit value",
args: []string{"--foo.default.bar.fuu"},
element: &struct {
Foo map[string]struct {
Bar *struct {
Fuu *struct{ Value string }
}
}
}{},
expected: map[string]string{
"traefik.foo.default.bar.fuu": "true",
},
},
{
desc: "slice with several flags 2 and different cases.",
args: []string{"--foo", "bar", "--Foo", "baz"},