mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 09:24:36 +00:00
* StringStream & more stdlib modules support for JS/NimScript * change back pegs test in line with #14134
23 lines
317 B
Nim
23 lines
317 B
Nim
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
|