From 8965ee59840dfa0ab439f9f6c11d725b41a1a013 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Sun, 15 Jun 2014 12:56:06 +0100 Subject: [PATCH] Add osproc stdin test. --- tests/osproc/ta.nim | 3 +++ tests/osproc/tstdin.nim | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 tests/osproc/ta.nim create mode 100644 tests/osproc/tstdin.nim diff --git a/tests/osproc/ta.nim b/tests/osproc/ta.nim new file mode 100644 index 0000000000..6c14955908 --- /dev/null +++ b/tests/osproc/ta.nim @@ -0,0 +1,3 @@ +import strutils +let x = stdin.readLine() +echo x.parseInt + 5 \ No newline at end of file diff --git a/tests/osproc/tstdin.nim b/tests/osproc/tstdin.nim new file mode 100644 index 0000000000..2ea9399924 --- /dev/null +++ b/tests/osproc/tstdin.nim @@ -0,0 +1,16 @@ +discard """ + file: "tstdin.nim" + output: "10" +""" +import osproc, os, streams + +doAssert fileExists(getCurrentDir() / "tests" / "osproc" / "ta.exe") + +var p = startProcess("ta.exe", getCurrentDir() / "tests" / "osproc") +p.inputStream.write("5\n") +while true: + let line = p.outputStream.readLine() + if line != "": + echo line + else: + break \ No newline at end of file