Skip to content

Commit

Permalink
Missing test file.
Browse files Browse the repository at this point in the history
  • Loading branch information
udhos committed Feb 23, 2017
1 parent c75b2f0 commit 8f6f8a8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Example:
go get github.com/icza/gowut/gwu
go get github.com/udhos/lockfile
go get github.com/udhos/equalfile
go get github.com/udhos/difflib
go get gopkg.in/yaml.v2
go get golang.org/x/crypto/ssh
go get github.com/aws/aws-sdk-go
Expand Down
28 changes: 28 additions & 0 deletions jazigo/ui_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package main

import (
"testing"
)

func TestSplitBufLines(t *testing.T) {
split(t, "", 0)
split(t, "x", 1)
split(t, "\n", 1)
split(t, "x\n", 1)
split(t, "\nx", 2)
split(t, "x\nx", 2)
split(t, "\n\n", 2)
split(t, "x\n\n", 2)
split(t, "\nx\n", 2)
split(t, "\n\nx", 3)
split(t, "\n\nx\n", 3)
split(t, "\n\n\n", 3)
}

func split(t *testing.T, input string, wantLineCount int) {
result := splitBufLines([]byte(input))
count := len(result)
if count != wantLineCount {
t.Errorf("splitBufLines: input=%v expected=%d got=%d", input, wantLineCount, count)
}
}

0 comments on commit 8f6f8a8

Please sign in to comment.