mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
add test for newFileStream() opening a missing file
This commit is contained in:
14
tests/stdlib/tstreams2.nim
Normal file
14
tests/stdlib/tstreams2.nim
Normal file
@@ -0,0 +1,14 @@
|
||||
discard """
|
||||
test newFileStream opening a missing file returns nil
|
||||
file: "tstreams2.nim"
|
||||
output: 'fs is: nil'
|
||||
"""
|
||||
import streams
|
||||
var
|
||||
fs = newFileStream("amissingfile.txt")
|
||||
line = ""
|
||||
echo "fs is: ",repr(fs)
|
||||
if not isNil(fs):
|
||||
while fs.readLine(line):
|
||||
echo line
|
||||
fs.close()
|
||||
Reference in New Issue
Block a user