aboutsummaryrefslogtreecommitdiffstats
path: root/client/go/internal/admin/jvm/properties_test.go
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2023-02-03 15:20:23 +0100
committerMartin Polden <mpolden@mpolden.no>2023-02-03 15:35:25 +0100
commite1e94812425a487069bf33f781bec987e9e49874 (patch)
tree4a892c3b5c0a7dee2cb76f9971e538cb4aba8a16 /client/go/internal/admin/jvm/properties_test.go
parenta08ae588d6035b69f0961dff596fc871fd1c4e58 (diff)
Re-organize Go code
Diffstat (limited to 'client/go/internal/admin/jvm/properties_test.go')
-rw-r--r--client/go/internal/admin/jvm/properties_test.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/client/go/internal/admin/jvm/properties_test.go b/client/go/internal/admin/jvm/properties_test.go
new file mode 100644
index 00000000000..c417319a51e
--- /dev/null
+++ b/client/go/internal/admin/jvm/properties_test.go
@@ -0,0 +1,27 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package jvm
+
+import (
+ "bytes"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestSomeQuoting(t *testing.T) {
+ var buf bytes.Buffer
+ propQuote("a=b", &buf)
+ assert.Equal(t, "a=b", buf.String())
+ buf.Reset()
+ propQuote("foobar", &buf)
+ assert.Equal(t, "foobar", buf.String())
+ buf.Reset()
+ propQuote("x y = foo bar ", &buf)
+ assert.Equal(t, `x\u0020y\u0020=\u0020foo bar `, buf.String())
+ buf.Reset()
+ propQuote("x:y=foo:bar", &buf)
+ assert.Equal(t, "x\\u003Ay=foo:bar", buf.String())
+ buf.Reset()
+ propQuote(`PS1=\[\e[0;32m\]AWS-US\[\e[0m\] [\u@\[\e[1m\]\h\[\e[0m\]:\w]$ `, &buf)
+ assert.Equal(t, `PS1=\\[\\e[0;32m\\]AWS-US\\[\\e[0m\\] [\\u@\\[\\e[1m\\]\\h\\[\\e[0m\\]:\\w]$ `, buf.String())
+}