File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 1+ macro "assert_eq! " t1:term ", " t2:term : doElem =>
2+ `(doElem| if $t1 != $t2 then throw (.userError s! "{ repr $t1} != { repr $t2} " ))
3+
4+ macro "assert_failure! " e:doElem : doElem =>
5+ `(doElem| try $e; throw (.userError s! "unexpected success" ) catch _ => pure ())
6+
7+ def runTests : IO Unit := do
8+ unless System.Platform.isWindows do
9+ return
10+ let out ← IO.Process.run { cmd := "cmd.exe" , args := #["/c" , "echo" , "hi" ] }
11+ assert_eq! out, "hi\r\n "
12+ assert_failure! discard <| IO.Process.run { cmd := "cmd.exe\" echo \" hi" }
13+ assert_failure! discard <| IO.Process.run { cmd := "cmd.exe\\ " }
14+ -- creating a lot of processes should succeed and not leak file handles
15+ for _ in [0 :500 ] do
16+ discard <| IO.Process.run { cmd := "cmd.exe" , args := #["/c" , "echo" , "hi" ] }
17+ --assert_failure! discard <| IO.Process.run { cmd := "cmd.exe\" echo \"hi" }
18+
19+ #eval runTests
You can’t perform that action at this time.
0 commit comments