Fix unit test for Windows and quit with failure code
This commit is contained in:
parent
2c3cc71540
commit
87e08bfb66
2 changed files with 4 additions and 2 deletions
|
|
@ -1,8 +1,10 @@
|
||||||
import os, osproc, strutils
|
import os, osproc, strutils
|
||||||
|
|
||||||
proc main() =
|
proc main() =
|
||||||
|
var failures = 0
|
||||||
for file in walkFiles(currentSourcePath().splitPath().head / "unittests/*.nim"):
|
for file in walkFiles(currentSourcePath().splitPath().head / "unittests/*.nim"):
|
||||||
let (path, fname, ext) = file.splitFile()
|
let (path, fname, ext) = file.splitFile()
|
||||||
if fname.startswith("test"):
|
if fname.startswith("test"):
|
||||||
discard execCmd "nim c -r " & file
|
failures += execCmd "nim c -r " & file
|
||||||
|
quit(failures)
|
||||||
main()
|
main()
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ suite "test file ops":
|
||||||
|
|
||||||
test "pipe command into file":
|
test "pipe command into file":
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
pipe(testfilename, "(ECHO foo)>>$file")
|
pipe(testfilename, "ECHO foo > $file")
|
||||||
testfilename.checkFile("foo")
|
testfilename.checkFile("foo")
|
||||||
else:
|
else:
|
||||||
pipe(testfilename, "cat $file | grep 'this is text'")
|
pipe(testfilename, "cat $file | grep 'this is text'")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue