From e0707797a52f68423b2cc9c287d6356366d41c56 Mon Sep 17 00:00:00 2001 From: JamesP Date: Sat, 26 Sep 2015 08:34:59 +1000 Subject: [PATCH] add test for newFileStream() opening a missing file --- tests/stdlib/tstreams2.nim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/stdlib/tstreams2.nim diff --git a/tests/stdlib/tstreams2.nim b/tests/stdlib/tstreams2.nim new file mode 100644 index 0000000000..b3e957261b --- /dev/null +++ b/tests/stdlib/tstreams2.nim @@ -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()