Skip to content

Commit

Permalink
Add unit test for Temp.clear_dir
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <[email protected]>
  • Loading branch information
rgrinberg committed Sep 3, 2020
1 parent 1c0dcdd commit c0975a2
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/expect-tests/stdune/temp_tests.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
open Stdune
open Dune_tests_common
open Dyn.Encoder

let () = init ()

let%expect_test "Temp.clear_dir works" =
let path = Temp.create Dir ~prefix:"dune." ~suffix:".unit_test" in
Path.touch (Path.relative path "foo");
let print () =
Path.readdir_unsorted path
|> Result.to_dyn (list string) opaque
|> print_dyn
in
print ();
Temp.clear_dir path;
print ();
[%expect {|
Ok [ "foo" ]
Ok [] |}]

0 comments on commit c0975a2

Please sign in to comment.