Skip to content

Commit

Permalink
test: spec of Path.mkdir_p w.r.t existing file / dir (#7420)
Browse files Browse the repository at this point in the history
Signed-off-by: Ali Caglayan <[email protected]>
  • Loading branch information
Alizter authored Mar 27, 2023
1 parent 7533eb9 commit 9264dda
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions otherlibs/stdune/test/io_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,14 @@ let%expect_test "copy file - dst is a directory" =
in
print_endline s;
[%expect {| $DIR: Is a directory |}]

let%expect_test "making a directory for an existing file" =
let dir = temp_dir () in
let fn = Path.relative dir "foo" in
Io.write_file fn "";
(* This does not error, but it will if it ends with a "/" on MacOS *)
ignore (Fpath.mkdir (Path.to_string fn));
[%expect {| |}];
Path.mkdir_p fn;
(* This in turn does not error *)
[%expect {| |}]

0 comments on commit 9264dda

Please sign in to comment.