fixes output stream casting problem
This commit is contained in:
parent
12250ec3ed
commit
e7a34b74f2
2 changed files with 15 additions and 2 deletions
|
|
@ -6,7 +6,9 @@ type
|
||||||
buffer: string
|
buffer: string
|
||||||
startOffset: int
|
startOffset: int
|
||||||
|
|
||||||
OutputStream* = object
|
# somehow casting outputDevice to
|
||||||
|
# OutputStreamVar requires RootObj
|
||||||
|
OutputStream* = object of RootObj
|
||||||
cursor*: WriteCursor
|
cursor*: WriteCursor
|
||||||
pages: Deque[OutputPage]
|
pages: Deque[OutputPage]
|
||||||
endPos: int
|
endPos: int
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ suite "output stream":
|
||||||
test "append zero length slice":
|
test "append zero length slice":
|
||||||
output ""
|
output ""
|
||||||
checkOutputsMatch()
|
checkOutputsMatch()
|
||||||
|
|
||||||
test "string output":
|
test "string output":
|
||||||
for i in 0 .. 1:
|
for i in 0 .. 1:
|
||||||
output $i
|
output $i
|
||||||
|
|
@ -150,3 +150,14 @@ suite "output stream":
|
||||||
# The final outputs are the same
|
# The final outputs are the same
|
||||||
check altOutput == memStream.getOutput
|
check altOutput == memStream.getOutput
|
||||||
|
|
||||||
|
test "nim odd behavior":
|
||||||
|
# discovered in status-im/nim-snappy#2
|
||||||
|
proc encode(s: OutputStreamVar) =
|
||||||
|
check true
|
||||||
|
|
||||||
|
proc abc(s: OutputStreamVar) =
|
||||||
|
OutputStreamVar(s.outputDevice).encode
|
||||||
|
check true
|
||||||
|
|
||||||
|
var os = new OutputStream
|
||||||
|
os.abc()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue