summary refs log blame commit diff stats
path: root/tests/js/tstreams.nim
blob: 43c26e01a139969afb570c8cb4a2d771531e1b19 (plain) (tree)





















                                       
discard """
  output: '''
I
AM
GROOT
'''
"""

import streams

var s = newStringStream("I\nAM\nGROOT")
doAssert s.peekStr(1) == "I"
doAssert s.peekChar() == 'I'
for line in s.lines:
  echo line
s.close

var s2 = newStringStream("abc")
doAssert s2.readAll == "abc"
s2.write("def")
doAssert s2.data == "abcdef"
s2.close