package ounit2-lwt

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file oUnitLwt.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
(** Helper to write Lwt tests with OUnit.

    As of 2019-09-19, this module is still experimental.
 *)

let () = OUnitRunnerProcesses.unix_fork := Lwt_unix.fork

(** [lwt_wrapper f] transforms an Lwt function into a test.

Example:
{[
let test =
  "SimpleAssertion" >::
  (lwt_wrapper
     (fun ctxt ->
        Lwt.return 4
        >>= fun i ->
        Lwt.return (assert_equal ~ctxt 4 i)))
]}
  *)
let lwt_wrapper f = fun ctxt -> f ctxt |> Lwt_main.run
OCaml

Innovation. Community. Security.