Skip to content

Commit f2e5494

Browse files
committed
add test
1 parent 6ff20f7 commit f2e5494

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/lean/run/8612.lean

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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

0 commit comments

Comments
 (0)