mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-06-19 06:33:06 -03:00
optimize line count and limit maximal file size to read; fixes #101
Signed-off-by: Denys Smirnov <denys@sourced.tech>
This commit is contained in:
committed by
Denys Smirnov
parent
c72d3c4af2
commit
6712d4219f
@ -27,10 +27,12 @@ func TestGetLines(t *testing.T) {
|
||||
}
|
||||
|
||||
for i, test := range tests {
|
||||
gotTotal, gotNonBlank := getLines([]byte(test.content))
|
||||
if gotTotal != test.wantTotal || gotNonBlank != test.wantNonBlank {
|
||||
t.Errorf("wrong line counts obtained for test case #%d:\n %7s, %7s\nGOT: %7d, %7d\nWANT: %7d, %7d\n", i, "TOTAL", "NON_BLANK",
|
||||
gotTotal, gotNonBlank, test.wantTotal, test.wantNonBlank)
|
||||
}
|
||||
t.Run("", func(t *testing.T) {
|
||||
gotTotal, gotNonBlank := getLines("", []byte(test.content))
|
||||
if gotTotal != test.wantTotal || gotNonBlank != test.wantNonBlank {
|
||||
t.Errorf("wrong line counts obtained for test case #%d:\n %7s, %7s\nGOT: %7d, %7d\nWANT: %7d, %7d\n", i, "TOTAL", "NON_BLANK",
|
||||
gotTotal, gotNonBlank, test.wantTotal, test.wantNonBlank)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user