StringStream & more stdlib modules support for JS/NimScript (#14095)

* StringStream & more stdlib modules support for JS/NimScript

* change back pegs test in line with #14134
This commit is contained in:
hlaaftana 2020-04-28 20:44:52 +03:00 • committed by GitHub
commit cd9af6b804
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 852 additions and 356 deletions

22
tests/js/tstreams.nim Normal file
View file

@ -0,0 +1,22 @@
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