aboutsummaryrefslogtreecommitdiff
path: root/internal/tlog/tlog_test.go
blob: 2e1c0348c49c7a8cf2c1cc923de39e1fe54b12ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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)
		}
	}
}