Something went wrong. Try again.
An embedded, single-file key-value store for OCaml, inspired by BoltDB and LMDB.
Something went wrong. Try again.
12345678910111213141516171819202122232425262728(** Tests for Error module *)
let test_to_string () = let open Lithos.Error in Alcotest.(check string) "IO_error message" "I/O error: file not found" (to_string (IO_error "file not found")); Alcotest.(check string) "Invalid_database message" "Invalid database: bad header" (to_string (Invalid_database "bad header")); Alcotest.(check string) "Database_locked message" "Database is locked" (to_string Database_locked); Alcotest.(check string) "Not_found message" "Not found" (to_string Not_found);;
let test_of_unix_error () = let open Lithos.Error in let err = of_unix_error Unix.ENOENT "/tmp/test.db" in let msg = to_string err in Alcotest.(check bool) "Unix error contains path" true (String.length msg > 0 && String.contains msg '/');;
let suite = [ "to_string", `Quick, test_to_string; "of_unix_error", `Quick, test_of_unix_error ]