diff options
author | Tomohiro <gpuppur@gmail.com> | 2018-11-26 18:28:44 +0900 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-11-26 10:28:44 +0100 |
commit | 3a3ff765261142482d716f6843f3aab631c7aaa1 (patch) | |
tree | 5e5da37e284cf890d93078ac1b5d7487788ce365 /tests/stdlib/tosproc.nim | |
parent | 3f3aee4078349b87e02c0120190e700cd0be2138 (diff) | |
download | Nim-3a3ff765261142482d716f6843f3aab631c7aaa1.tar.gz |
Add workingDir parameter to execProcess and test (#9549)
* Add workingDir parameter to execProcess * Fix tests/stdlib/tosproc.nim compile error * Suppress output from tosproc.nim
Diffstat (limited to 'tests/stdlib/tosproc.nim')
-rw-r--r-- | tests/stdlib/tosproc.nim | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/stdlib/tosproc.nim b/tests/stdlib/tosproc.nim new file mode 100644 index 000000000..ac129e709 --- /dev/null +++ b/tests/stdlib/tosproc.nim @@ -0,0 +1,24 @@ +discard """ + file: "tospaths.nim" + output: "" +""" +# test the osproc module + +import os, osproc + +block execProcessTest: + let dir = parentDir(currentSourcePath()) + let (outp, err) = execCmdEx("nim c " & quoteShell(dir / "osproctest.nim")) + doAssert err == 0 + let exePath = dir / addFileExt("osproctest", ExeExt) + let outStr1 = execProcess(exePath, workingDir=dir, args=["foo", "b A r"], options={}) + doAssert outStr1 == dir & "\nfoo\nb A r\n" + + const testDir = "t e st" + createDir(testDir) + doAssert dirExists(testDir) + let outStr2 = execProcess(exePath, workingDir=testDir, args=["x yz"], options={}) + doAssert outStr2 == absolutePath(testDir) & "\nx yz\n" + + removeDir(testDir) + removeFile(exePath) |