summaryrefslogtreecommitdiff
path: root/pkg/systemd/generate/common_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/systemd/generate/common_test.go')
-rw-r--r--pkg/systemd/generate/common_test.go25
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)
+ }
+}