diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-08-19 15:51:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-19 15:51:20 +0200 |
commit | dd4e0da4241ac0b6deac3f5e07ea4eeb5819379e (patch) | |
tree | 3039b25f051e891d0717be53b856410a3b98c657 /pkg/systemd/generate/common_test.go | |
parent | 45b3d61c5550f8a998f2117c52b26e53955ba56a (diff) | |
parent | b1ffa2324eaf3e3d847ce4e0f738d6bf9e46a54b (diff) | |
download | podman-dd4e0da4241ac0b6deac3f5e07ea4eeb5819379e.tar.gz podman-dd4e0da4241ac0b6deac3f5e07ea4eeb5819379e.tar.bz2 podman-dd4e0da4241ac0b6deac3f5e07ea4eeb5819379e.zip |
Merge pull request #7350 from vrothberg/fix-7285
generate systemd: quote arguments with whitespace
Diffstat (limited to 'pkg/systemd/generate/common_test.go')
-rw-r--r-- | pkg/systemd/generate/common_test.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/pkg/systemd/generate/common_test.go b/pkg/systemd/generate/common_test.go index 389c30f59..d0ec5637c 100644 --- a/pkg/systemd/generate/common_test.go +++ b/pkg/systemd/generate/common_test.go @@ -28,3 +28,28 @@ func TestFilterPodFlags(t *testing.T) { } } } + +func TestQuoteArguments(t *testing.T) { + tests := []struct { + input []string + output []string + }{ + { + []string{"foo", "bar=\"arg\""}, + []string{"foo", "bar=\"arg\""}, + }, + { + []string{"foo", "bar=\"arg with space\""}, + []string{"foo", "\"bar=\\\"arg with space\\\"\""}, + }, + { + []string{"foo", "bar=\"arg with\ttab\""}, + []string{"foo", "\"bar=\\\"arg with\\ttab\\\"\""}, + }, + } + + for _, test := range tests { + quoted := quoteArguments(test.input) + assert.Equal(t, test.output, quoted) + } +} |