aboutsummaryrefslogtreecommitdiff
path: root/internal/tlog/tlog_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/tlog/tlog_test.go')
-rw-r--r--internal/tlog/tlog_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/internal/tlog/tlog_test.go b/internal/tlog/tlog_test.go
new file mode 100644
index 0000000..2e1c034
--- /dev/null
+++ b/internal/tlog/tlog_test.go
@@ -0,0 +1,26 @@
+package tlog
+
+import (
+ "testing"
+)
+
+// Test that trimNewline() works as expected
+func TestTrimNewline(t *testing.T) {
+ testTable := []struct {
+ in string
+ want string
+ }{
+ {"...\n", "..."},
+ {"\n...\n", "\n..."},
+ {"", ""},
+ {"\n", ""},
+ {"\n\n", "\n"},
+ {" ", " "},
+ }
+ for _, v := range testTable {
+ have := trimNewline(v.in)
+ if v.want != have {
+ t.Errorf("want=%q have=%q", v.want, have)
+ }
+ }
+}