aboutsummaryrefslogtreecommitdiffstats
path: root/skate/zippy_test.go
blob: 14484726ad3a6d8c0815711347ba337e01a3a504 (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
package skate

import "testing"

func TestLineColumn(t *testing.T) {
	var cases = []struct {
		line   string
		sep    string
		column int
		result string
	}{
		{"", "", 2, ""},
		{"1 2 3", " ", 1, "1"},
		{"1 2 3", " ", 2, "2"},
		{"1 2 3", " ", 3, "3"},
		{"1 2 3", " ", 4, ""},
		{"1 2 3", "\t", 1, "1 2 3"},
	}
	for _, c := range cases {
		result := CutSep(c.line, c.sep, c.column)
		if result != c.result {
			t.Fatalf("got %v, want %v", result, c.result)
		}
	}
}