diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-08-27 07:23:26 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-27 07:23:26 -0400 |
commit | 6f61ef87afe6695ca6cbd6e3b818ef619b6d54da (patch) | |
tree | 7fc34428445851eb790943050a4c68074a516133 /cmd/podman/common/completion_test.go | |
parent | 94c37d7d470871f9d63b32c97094f5faab1e8a08 (diff) | |
parent | ab6c43f3e072d088149c4f5371e0e53ff14ec7ff (diff) | |
download | podman-6f61ef87afe6695ca6cbd6e3b818ef619b6d54da.tar.gz podman-6f61ef87afe6695ca6cbd6e3b818ef619b6d54da.tar.bz2 podman-6f61ef87afe6695ca6cbd6e3b818ef619b6d54da.zip |
Merge pull request #11337 from Luap99/anon-template
Shell completion for --format with anonymous fields
Diffstat (limited to 'cmd/podman/common/completion_test.go')
-rw-r--r-- | cmd/podman/common/completion_test.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/cmd/podman/common/completion_test.go b/cmd/podman/common/completion_test.go index 5bd627b85..84b3c1132 100644 --- a/cmd/podman/common/completion_test.go +++ b/cmd/podman/common/completion_test.go @@ -17,6 +17,10 @@ type Car struct { Extras map[string]string } +type Anonymous struct { + Hello string +} + func (c Car) Type() string { return "" } @@ -30,7 +34,10 @@ func TestAutocompleteFormat(t *testing.T) { Name string Age int Car *Car - }{} + *Anonymous + }{ + Anonymous: &Anonymous{}, + } testStruct.Car = &Car{} testStruct.Car.Extras = map[string]string{"test": "1"} @@ -73,12 +80,12 @@ func TestAutocompleteFormat(t *testing.T) { { "fist level struct field name", "{{.", - []string{"{{.Name}}", "{{.Age}}", "{{.Car."}, + []string{"{{.Name}}", "{{.Age}}", "{{.Car.", "{{.Anonymous.", "{{.Hello}}"}, }, { "fist level struct field name", "{{ .", - []string{"{{ .Name}}", "{{ .Age}}", "{{ .Car."}, + []string{"{{ .Name}}", "{{ .Age}}", "{{ .Car.", "{{ .Anonymous.", "{{ .Hello}}"}, }, { "fist level struct field name", |