mirror of
https://github.com/walles/moar.git
synced 2024-11-26 04:21:11 +03:00
Add another test case
diff --git m/reader_test.go m/reader_test.go index 176192b..bed1e33 100644 --- m/reader_test.go +++ m/reader_test.go @@ -30,6 +30,12 @@ func _TestGetLineCount(t *testing.T, reader *Reader) { if err != nil { t.Error("Error counting lines of", *reader.name, err) } + + if strings.HasSuffix(*reader.name, "/line-without-newline.txt") { + // "wc -l" thinks this file contains zero lines + fileLineCount = 1 + } + if reader.GetLineCount() != fileLineCount { t.Errorf("Got %d lines but expected %d: <%s>", reader.GetLineCount(), fileLineCount, *reader.name) diff --git sample-files/line-without-newline.txt sample-files/line-without-newline.txt new file mode 100644 index 0000000..2260c57 --- /dev/null +++ sample-files/line-without-newline.txt @@ -0,0 +1 @@ +This file contains no newlines \ No newline at end of file Change-Id: Ic2801ce3477a7afd4537d340385c884c5f2b7438
This commit is contained in:
parent
8d9155061a
commit
b781d09a72
@ -30,6 +30,12 @@ func _TestGetLineCount(t *testing.T, reader *Reader) {
|
||||
if err != nil {
|
||||
t.Error("Error counting lines of", *reader.name, err)
|
||||
}
|
||||
|
||||
if strings.HasSuffix(*reader.name, "/line-without-newline.txt") {
|
||||
// "wc -l" thinks this file contains zero lines
|
||||
fileLineCount = 1
|
||||
}
|
||||
|
||||
if reader.GetLineCount() != fileLineCount {
|
||||
t.Errorf("Got %d lines but expected %d: <%s>",
|
||||
reader.GetLineCount(), fileLineCount, *reader.name)
|
||||
|
1
sample-files/line-without-newline.txt
Normal file
1
sample-files/line-without-newline.txt
Normal file
@ -0,0 +1 @@
|
||||
This file contains no newlines
|
Loading…
Reference in New Issue
Block a user