From 9b86ae7b194dd31cbb0bbaa3e3a55dab4795ba3c Mon Sep 17 00:00:00 2001 From: Johan Walles Date: Thu, 15 Apr 2021 14:51:51 +0200 Subject: [PATCH] Fix long-line test On Windows the sample file gets cloned with Windows newlines, breaking the file-size assumption. And having a constant here makes the test simpler and better anyway, Windows or not. --- m/reader_test.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/m/reader_test.go b/m/reader_test.go index cdd1ed4..a21893b 100644 --- a/m/reader_test.go +++ b/m/reader_test.go @@ -3,7 +3,6 @@ package m import ( "io/ioutil" "math" - "os" "os/exec" "path" "runtime" @@ -161,14 +160,7 @@ func TestGetLongLine(t *testing.T) { assert.Assert(t, strings.HasPrefix(line.Plain(), "1 2 3 4"), "<%s>", line) assert.Assert(t, strings.HasSuffix(line.Plain(), "0123456789"), line) - stat, err := os.Stat(file) - if err != nil { - panic(err) - } - fileSize := stat.Size() - - // The "+1" is because the Reader strips off the ending linefeed - assert.Equal(t, len(line.Plain())+1, int(fileSize)) + assert.Equal(t, len(line.Plain()), 100021) } func getReaderWithLineCount(totalLines int) *Reader {