Bugfix: totalUnconsumedBytes works properly within withReadableRange blocks
This commit is contained in:
parent
5d7cad792f
commit
81c24860e2
2 changed files with 13 additions and 2 deletions
|
|
@ -48,6 +48,9 @@ procSuite "input stream":
|
|||
test "next returns none":
|
||||
check input.next.isNone
|
||||
|
||||
emptyInputTests "memoryInput":
|
||||
var input = InputStream()
|
||||
|
||||
emptyInputTests "unsafeMemoryInput":
|
||||
var str = ""
|
||||
var input = unsafeMemoryInput(str)
|
||||
|
|
@ -140,12 +143,16 @@ procSuite "input stream":
|
|||
let s = fileInput(asciiTableFile, pageSize = 100)
|
||||
if s.readable(20):
|
||||
s.withReadableRange(20, r):
|
||||
check r.len.get == 20
|
||||
check r.totalUnconsumedBytes == 20
|
||||
check r.readAll.len == 20
|
||||
|
||||
check s.readable
|
||||
|
||||
if s.readable(200):
|
||||
s.withReadableRange(200, r):
|
||||
check r.len.get == 200
|
||||
check r.totalUnconsumedBytes == 200
|
||||
check r.readAll.len == 200
|
||||
|
||||
check s.readable
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue