From 830e7c5d27d161b91402414e6ecd49f1ed818bfb Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Fri, 27 Mar 2026 08:48:05 +0100 Subject: Initial commit --- test/common.ml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 test/common.ml (limited to 'test/common.ml') diff --git a/test/common.ml b/test/common.ml new file mode 100644 index 0000000..807289a --- /dev/null +++ b/test/common.ml @@ -0,0 +1,13 @@ +(** Common fuctions shared between the tests *) + +let ( let* ) = Lwt.bind + +(** Connect to the database in memory and create a schema matching the given + configuration *) +let connect : Configuration.Ast.setting -> Caqti_lwt.connection Lwt.t = + fun conf -> + let* conn = Caqti_lwt_unix.connect (Uri.of_string "sqlite3::memory:") in + let* db = Caqti_lwt.or_fail conn in + let module Db = (val db) in + let* () = Query.create db conf in + Lwt.return db -- cgit v1.2.3