aboutsummaryrefslogtreecommitdiffstats
path: root/skate/zippy_test.go
blob: 49f4a54e38fb77d25dc4ba0c0b52fbfc088892b8 (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 := lineColumn(c.line, c.sep, c.column)
		if result != c.result {
			t.Fatalf("got %v, want %v", result, c.result)
		}
	}
}