Skip to content

Commit ca1d239

Browse files
authored
Merge pull request #662 from SGrondin/idempotent-tests2
Fix non-idempotent tests
2 parents 5e014fc + c680726 commit ca1d239

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tests/fd_passing.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
open Eio.Std
99
1010
let ( / ) = Eio.Path.( / )
11+
12+
let run ?clear:(paths = []) fn =
13+
Eio_main.run @@ fun env ->
14+
let cwd = Eio.Stdenv.cwd env in
15+
List.iter (fun p -> Eio.Path.rmtree ~missing_ok:true (cwd / p)) paths;
16+
fn env
1117
```
1218

1319
```ocaml
@@ -45,7 +51,7 @@ let with_tmp_file dir id fn =
4551
Using a socket-pair:
4652

4753
```ocaml
48-
# Eio_main.run @@ fun env ->
54+
# run ~clear:["tmp-foo.txt"; "tmp-bar.txt"] @@ fun env ->
4955
with_tmp_file env#cwd "foo" @@ fun fd1 ->
5056
with_tmp_file env#cwd "bar" @@ fun fd2 ->
5157
Switch.run @@ fun sw ->
@@ -60,7 +66,7 @@ Using a socket-pair:
6066
Using named sockets:
6167

6268
```ocaml
63-
# Eio_main.run @@ fun env ->
69+
# run ~clear:["tmp-foo.txt"] @@ fun env ->
6470
let net = env#net in
6571
with_tmp_file env#cwd "foo" @@ fun fd ->
6672
Switch.run @@ fun sw ->

0 commit comments

Comments
 (0)