summaryrefslogtreecommitdiff
path: root/utilities/utilities_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'utilities/utilities_test.go')
-rw-r--r--utilities/utilities_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/utilities/utilities_test.go b/utilities/utilities_test.go
index 7f3d83a..8f43c6d 100644
--- a/utilities/utilities_test.go
+++ b/utilities/utilities_test.go
@@ -188,3 +188,23 @@ func TestTrimmedMean(t *testing.T) {
t.Fatalf("The trimmed mean result %v does not match the expected value %v", result, expected)
}
}
+
+func TestIndentStringOneNewline(t *testing.T) {
+ output := "This is my output\n"
+
+ indendentedOutput := IndentOutput(output, 3, "--")
+
+ if indendentedOutput != "------This is my output\n" {
+ t.Fatalf("I expected the indented output to be ####%v#### but got ####%v####!", output, indendentedOutput)
+ }
+}
+
+func TestIndentStringMultipleNewlines(t *testing.T) {
+ output := "This is my output\n\n"
+
+ indendentedOutput := IndentOutput(output, 3, "--")
+
+ if indendentedOutput != "------This is my output\n------\n" {
+ t.Fatalf("I expected the indented output to be ####%v#### but got ####%v####!", output, indendentedOutput)
+ }
+}