summaryrefslogtreecommitdiffstats
path: root/pkg/utils/utils_test.go
blob: 3a9f6817bf537e7360091d5c731cdfae03e5958e (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
27
28
29
30
31
32
33
34
package utils

import "testing"

var testCases = []struct {
	Input	 []byte
	Expected []byte
}{
	{
		// \r\n
		Input: []byte{97, 115, 100, 102, 13, 10},
		Expected: []byte{97, 115, 100, 102, 10},
	},
	{
		// \r
		Input: []byte{97, 115, 100, 102, 13},
		Expected: []byte{97, 115, 100, 102, 10},
	},
	{
		// \n
		Input: []byte{97, 115, 100, 102, 10},
		Expected: []byte{97, 115, 100, 102, 10},
	},

}

func TestNormalizeLinefeeds(t *testing.T) {

	for _, tc := range testCases {
		if NormalizeLinefeeds(string(tc.Input)) != string(tc.Expected) {
			t.Error("Error")
		}
	}
}