Add osproc stdin test.

This commit is contained in:
Dominik Picheta
2014-06-15 12:56:06 +01:00
parent 370f06d557
commit 8965ee5984
2 changed files with 19 additions and 0 deletions

3
tests/osproc/ta.nim Normal file
View File

@@ -0,0 +1,3 @@
import strutils
let x = stdin.readLine()
echo x.parseInt + 5

16
tests/osproc/tstdin.nim Normal file
View File

@@ -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