summaryrefslogtreecommitdiff
path: root/cmd/podman/common/completion_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/common/completion_test.go')
-rw-r--r--cmd/podman/common/completion_test.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/cmd/podman/common/completion_test.go b/cmd/podman/common/completion_test.go
index d28ac3928..bfff9a96e 100644
--- a/cmd/podman/common/completion_test.go
+++ b/cmd/podman/common/completion_test.go
@@ -34,10 +34,9 @@ func TestAutocompleteFormat(t *testing.T) {
Name string
Age int
Car *Car
+ Car2 *Car
*Anonymous
- }{
- Anonymous: &Anonymous{},
- }
+ }{}
testStruct.Car = &Car{}
testStruct.Car.Extras = map[string]string{"test": "1"}
@@ -80,12 +79,12 @@ func TestAutocompleteFormat(t *testing.T) {
{
"fist level struct field name",
"{{.",
- []string{"{{.Name}}", "{{.Age}}", "{{.Car.", "{{.Anonymous.", "{{.Hello}}"},
+ []string{"{{.Name}}", "{{.Age}}", "{{.Car.", "{{.Car2.", "{{.Anonymous.", "{{.Hello}}"},
},
{
"fist level struct field name",
"{{ .",
- []string{"{{ .Name}}", "{{ .Age}}", "{{ .Car.", "{{ .Anonymous.", "{{ .Hello}}"},
+ []string{"{{ .Name}}", "{{ .Age}}", "{{ .Car.", "{{ .Car2.", "{{ .Anonymous.", "{{ .Hello}}"},
},
{
"fist level struct field name",
@@ -103,6 +102,11 @@ func TestAutocompleteFormat(t *testing.T) {
[]string{"{{ .Car.Brand}}"},
},
{
+ "second level nil struct field name",
+ "{{ .Car2.",
+ []string{"{{ .Car2.Brand}}", "{{ .Car2.Stats.", "{{ .Car2.Extras}}", "{{ .Car2.Color}}", "{{ .Car2.Type}}"},
+ },
+ {
"three level struct field name",
"{{ .Car.Stats.",
[]string{"{{ .Car.Stats.HP}}", "{{ .Car.Stats.Displacement}}"},