Add osproc stdin test.
This commit is contained in:
parent
370f06d557
commit
8965ee5984
2 changed files with 19 additions and 0 deletions
3
tests/osproc/ta.nim
Normal file
3
tests/osproc/ta.nim
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import strutils
|
||||
let x = stdin.readLine()
|
||||
echo x.parseInt + 5
|
||||
16
tests/osproc/tstdin.nim
Normal file
16
tests/osproc/tstdin.nim
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue