aboutsummaryrefslogtreecommitdiffstats
path: root/test/Helpers.ml
diff options
context:
space:
mode:
authorEstevan Castilho <tevo@riajuu.net>2026-07-15 01:52:38 +0000
committerGitHub <noreply@github.com>2026-07-14 22:52:38 -0300
commitc374635a36d71e8cfff6e1c19b62e5d0e14ea371 (patch)
tree597fba69d4b39452eabab6299887282c1d7c6bc6 /test/Helpers.ml
parentbb3156b8ab78b035ce886bbe3021ec7cbe269d03 (diff)
downloadRNT-c374635a36d71e8cfff6e1c19b62e5d0e14ea371.tar.gz
RNT-c374635a36d71e8cfff6e1c19b62e5d0e14ea371.zip
Storage layer scaffolding, LMDB backend
Diffstat (limited to '')
-rw-r--r--test/Helpers.ml19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/Helpers.ml b/test/Helpers.ml
new file mode 100644
index 0000000..bf34b82
--- /dev/null
+++ b/test/Helpers.ml
@@ -0,0 +1,19 @@
+open Rnt
+
+let rec recursively_remove path =
+ if Sys.is_directory path then begin
+ Sys.readdir path |> Array.iter (fun name -> recursively_remove (Filename.concat path name));
+ Unix.rmdir path
+ end
+ else Sys.remove path
+
+let with_temporary_directory prefix ?(suffix = "") f =
+ let path = Filename.temp_dir ~temp_dir:"/tmp" prefix suffix in
+ Fun.protect (fun () -> f path) ~finally:(fun () -> recursively_remove path)
+
+let condition_as_failure = function
+ | Ok r -> r
+ | Error c -> Alcotest.fail (Concepts.Condition.to_string_hum c)
+
+let pp_value ppf v = Format.pp_print_string ppf (Concepts.Value.to_string v)
+let value = Alcotest.testable pp_value Concepts.Value.equal