Skip to content

Commit

Permalink
test: dropping entire prefix for Path.drop_prefix (#9363)
Browse files Browse the repository at this point in the history
We add a test demonstrating that dropping the entire path as the refix
in both Path.drop_prefix and Path.External.drop_prefix has a set
behaviour. This is in preperation of #8965.

Signed-off-by: Ali Caglayan <[email protected]>
  • Loading branch information
Alizter authored Dec 3, 2023
1 parent 8445ca1 commit 8502f33
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions otherlibs/stdune/test/path_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -494,3 +494,15 @@ let%expect_test "drop external prefix as substring" =
|> print_dyn;
[%expect {| Some "baz" |}]
;;

let%expect_test "drop entire path" =
let path = r "foo/bar" in
Path.drop_prefix ~prefix:path path |> Dyn.option Path.Local.to_dyn |> print_dyn;
[%expect {| Some "." |}]
;;

let%expect_test "drop entire external path" =
let path = Path.External.of_filename_relative_to_initial_cwd "foo/bar" in
Path.External.drop_prefix ~prefix:path path |> Dyn.option Path.Local.to_dyn |> print_dyn;
[%expect {| Some "." |}]
;;

0 comments on commit 8502f33

Please sign in to comment.