CI: test with multiple Nim versions (#23)

* CI: test with multiple Nim versions

* fix readIntoExImpl() when premature EOF is triggered on some Windows versions
* also fix some unrelated pointer math
This commit is contained in:
Ștefan Talpalaru 2022-01-05 23:22:53 +01:00 • committed by GitHub
commit 371e60b17c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 141 additions and 135 deletions

View file

@ -1,7 +1,7 @@
{.used.}
import
os, unittest, random, strformat,
os, unittest2, random, strformat,
stew/ranges/ptr_arith,
../faststreams, ../faststreams/textio
@ -20,12 +20,10 @@ proc repeat(b: byte, count: int): seq[byte] =
result = newSeq[byte](count)
for i in 0 ..< count: result[i] = b
const line = "123456789123456789123456789123456789\n\n\n\n\n"
proc randomBytes(n: int): seq[byte] =
result.newSeq n
for i in 0 ..< n:
result[i] = byte(rand(line))
result[i] = byte(rand(int('1')..int('9')))
proc readAllAndClose(s: InputStream): seq[byte] =
while s.readable:
@ -55,6 +53,8 @@ suite "output stream":
streamWritingToExistingBuffer = unsafeMemoryOutput(buffer, bufferSize)
teardown:
fileStream.close()
unbufferedFileStream.close()
removeFile fileOutputPath
removeFile unbufferedFileOutputPath
dealloc buffer