diff options
Diffstat (limited to 'skate/zippy_test.go')
-rw-r--r-- | skate/zippy_test.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/skate/zippy_test.go b/skate/zippy_test.go new file mode 100644 index 0000000..49f4a54 --- /dev/null +++ b/skate/zippy_test.go @@ -0,0 +1,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) + } + } +} |