merge stdlib tests (#9439)
This commit is contained in:
parent
3b1ade0350
commit
9fb212cfdf
28 changed files with 458 additions and 522 deletions
|
|
@ -1,7 +1,27 @@
|
|||
import streams
|
||||
|
||||
var outp = newFileStream(stdout)
|
||||
var inp = newFileStream(stdin)
|
||||
write(outp, "Hello! What is your name?")
|
||||
var line = readLine(inp)
|
||||
write(outp, "Nice name: " & line)
|
||||
|
||||
block tstreams:
|
||||
var outp = newFileStream(stdout)
|
||||
var inp = newFileStream(stdin)
|
||||
write(outp, "Hello! What is your name?")
|
||||
var line = readLine(inp)
|
||||
write(outp, "Nice name: " & line)
|
||||
|
||||
|
||||
block tstreams2:
|
||||
var
|
||||
fs = newFileStream("amissingfile.txt")
|
||||
line = ""
|
||||
echo "fs is: ",repr(fs)
|
||||
if not isNil(fs):
|
||||
while fs.readLine(line):
|
||||
echo line
|
||||
fs.close()
|
||||
|
||||
|
||||
block tstreams3:
|
||||
try:
|
||||
var fs = openFileStream("shouldneverexist.txt")
|
||||
except IoError:
|
||||
echo "threw exception"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue