summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@googlemail.com>2014-06-15 12:56:06 +0100
committerDominik Picheta <dominikpicheta@googlemail.com>2014-06-15 12:57:05 +0100
commit8965ee59840dfa0ab439f9f6c11d725b41a1a013 (patch)
tree5986ea8f8ce4fe29687b2784d207612f08e1dea7
parent370f06d55719e8832a6c41d360bd78bf441c415c (diff)
downloadNim-8965ee59840dfa0ab439f9f6c11d725b41a1a013.tar.gz
Add osproc stdin test.
-rw-r--r--tests/osproc/ta.nim3
-rw-r--r--tests/osproc/tstdin.nim16
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/osproc/ta.nim b/tests/osproc/ta.nim
new file mode 100644
index 000000000..6c1495590
--- /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 000000000..2ea939992
--- /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