mirror of
https://github.com/walles/moar.git
synced 2024-11-11 00:27:04 +03:00
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.
This commit is contained in:
parent
e502b68bc9
commit
9b86ae7b19
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user