summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDave Henderson <dhenderson@gmail.com>2017-06-14 00:42:15 -0400
committerDave Henderson <dhenderson@gmail.com>2017-06-14 00:42:15 -0400
commitd57d2c7d60fd5cfa43e83445675a87da9ce19d29 (patch)
tree3b1e7220bb71d58a8ec14cca564a9f304d5d42c4 /test
parent19c7f34bcacded8002fe561a728cfc05a2d6da06 (diff)
Enhancing indent function
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/integration/strings.bats30
-rw-r--r--test/integration/typeconv_funcs.bats8
2 files changed, 30 insertions, 8 deletions
diff --git a/test/integration/strings.bats b/test/integration/strings.bats
new file mode 100644
index 00000000..9d16eb25
--- /dev/null
+++ b/test/integration/strings.bats
@@ -0,0 +1,30 @@
+#!/usr/bin/env bats
+
+load helper
+
+tmpdir=$(mktemp -u)
+
+function setup () {
+ mkdir -p $tmpdir
+}
+
+function teardown () {
+ rm -rf $tmpdir || true
+}
+
+@test "'strings.Indent'" {
+ gomplate -i '{{ strings.Indent " " "hello world" }}
+{{ "hello\nmultiline\nworld" | indent 2 "-" }}
+{{ "foo\nbar" | strings.Indent 2 }}
+ {{"hello\nworld" | strings.Indent 5 | strings.TrimSpace }}
+'
+ [ "$status" -eq 0 ]
+ [[ "${output}" == " hello world
+--hello
+--multiline
+--world
+ foo
+ bar
+ hello
+ world" ]]
+}
diff --git a/test/integration/typeconv_funcs.bats b/test/integration/typeconv_funcs.bats
index 0b22f311..bb6f52bd 100644
--- a/test/integration/typeconv_funcs.bats
+++ b/test/integration/typeconv_funcs.bats
@@ -44,14 +44,6 @@ function teardown () {
}' ]]
}
-@test "indent" {
- gomplate -i '{{ indent " " "hello world" }}{{ "hello\nmultiline\nworld" | indent " " }}'
- [ "$status" -eq 0 ]
- [[ "${output}" == " hello world hello
- multiline
- world" ]]
-}
-
@test "join" {
gomplate -i '{{ $a := `[1, 2, 3]` | jsonArray }}{{ join $a "-" }}'
[ "$status" -eq 0 ]