Skip to content

Commit 1234a0b

Browse files
Update fs.md
Co-Authored-By: Patrick Ferris <[email protected]>
1 parent 2c3c5e1 commit 1234a0b

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

tests/fs.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,10 @@ let try_symlink ~link_to path =
9595
| exception ex -> traceln "@[<h>%a@]" Eio.Exn.pp ex
9696
9797
let try_chmod ~perm path =
98-
match Eio.Path.chmod ~perm path with
98+
match Path.chmod ~perm path with
9999
| () -> Eio.traceln "chmod %o -> %a" perm Path.pp path
100100
| exception ex -> Eio.traceln "@[<h>%a@]" Eio.Exn.pp ex
101+
101102
```
102103

103104
# Basic test cases
@@ -848,6 +849,7 @@ Unconfined:
848849
- : unit = ()
849850
```
850851

852+
851853
# read_link
852854

853855
```ocaml
@@ -1015,3 +1017,23 @@ Exception: Failure "Simulated error".
10151017
+"/" / "" = "/"
10161018
- : unit = ()
10171019
```
1020+
1021+
```ocaml
1022+
run ~clear:["stat_subdir2"; "symlink"; "broken-symlink"; "parent-symlink"] @@ fun env ->
1023+
let cwd = Eio.Stdenv.cwd env in
1024+
Switch.run @@ fun sw ->
1025+
Path.mkdir (cwd / "stat_subdir2");
1026+
Path.symlink ~link_to:"stat_subdir2" (cwd / "symlink");
1027+
Path.symlink ~link_to:"missing" (cwd / "broken-symlink");
1028+
try_stat (cwd / "stat_subdir2");
1029+
try_stat (cwd / "symlink");
1030+
try_stat (cwd / "broken-symlink");
1031+
try_chmod ~perm:0o777 (cwd / "stat_subdir2");
1032+
try_stat cwd;
1033+
try_stat (cwd / "..");
1034+
try_stat (cwd / "stat_subdir2/..");
1035+
Path.symlink ~link_to:".." (cwd / "parent-symlink");
1036+
try_stat (cwd / "parent-symlink");
1037+
try_stat (cwd / "missing1" / "missing2");
1038+
();
1039+
```

0 commit comments

Comments
 (0)