mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-19 15:31:28 +00:00
Add osproc stdin test.
This commit is contained in:
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
|
||||
Reference in New Issue
Block a user