mirror of
https://github.com/walles/moar.git
synced 2024-11-30 02:34:13 +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 (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math"
|
"math"
|
||||||
"os"
|
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path"
|
"path"
|
||||||
"runtime"
|
"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.HasPrefix(line.Plain(), "1 2 3 4"), "<%s>", line)
|
||||||
assert.Assert(t, strings.HasSuffix(line.Plain(), "0123456789"), line)
|
assert.Assert(t, strings.HasSuffix(line.Plain(), "0123456789"), line)
|
||||||
|
|
||||||
stat, err := os.Stat(file)
|
assert.Equal(t, len(line.Plain()), 100021)
|
||||||
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))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func getReaderWithLineCount(totalLines int) *Reader {
|
func getReaderWithLineCount(totalLines int) *Reader {
|
||||||
|
Loading…
Reference in New Issue
Block a user