diff --git a/faststreams/output_stream.nim b/faststreams/output_stream.nim index 5fd8dae..e9f3c26 100644 --- a/faststreams/output_stream.nim +++ b/faststreams/output_stream.nim @@ -6,7 +6,9 @@ type buffer: string startOffset: int - OutputStream* = object + # somehow casting outputDevice to + # OutputStreamVar requires RootObj + OutputStream* = object of RootObj cursor*: WriteCursor pages: Deque[OutputPage] endPos: int diff --git a/tests/test_output_stream.nim b/tests/test_output_stream.nim index 90f17a2..4514743 100644 --- a/tests/test_output_stream.nim +++ b/tests/test_output_stream.nim @@ -58,7 +58,7 @@ suite "output stream": test "append zero length slice": output "" checkOutputsMatch() - + test "string output": for i in 0 .. 1: output $i @@ -150,3 +150,14 @@ suite "output stream": # The final outputs are the same 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()