fixes zero length input bug in output_stream.append
This commit is contained in:
parent
1e85ab9150
commit
12250ec3ed
2 changed files with 5 additions and 0 deletions
|
|
@ -356,6 +356,7 @@ proc append*(c: var WriteCursor, bytes: openarray[byte]) {.inline.} =
|
|||
pageRemaining = c.runway
|
||||
inputLen = bytes.len
|
||||
|
||||
if inputLen == 0: return
|
||||
if inputLen <= pageRemaining:
|
||||
copyMem(c.head, unsafeAddr bytes[0], inputLen)
|
||||
c.head = shift(c.head, inputLen)
|
||||
|
|
|
|||
|
|
@ -55,6 +55,10 @@ suite "output stream":
|
|||
test "no appends produce an empty output":
|
||||
checkOutputsMatch()
|
||||
|
||||
test "append zero length slice":
|
||||
output ""
|
||||
checkOutputsMatch()
|
||||
|
||||
test "string output":
|
||||
for i in 0 .. 1:
|
||||
output $i
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue