Skip to content

Commit

Permalink
README: New usage example for LWT
Browse files Browse the repository at this point in the history
With ppx_expect v0.16 there was a change to Expect_test_config_types.S where IO_run and IO_flush were replaced with IO. 

Signed-off-by: Marc Coquand <[email protected]>
  • Loading branch information
MarcCoquand authored Feb 11, 2024
1 parent b312070 commit 68f03c8
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -186,25 +186,20 @@ as the former.
This is what you would need to write expect tests with Lwt:

#+begin_src ocaml
module Lwt_io_run = struct
module Lwt_io = struct
type 'a t = 'a Lwt.t
end

module Lwt_io_flush = struct
type 'a t = 'a Lwt.t
let return x = Lwt.return x
let bind x ~f = Lwt.bind x f
let to_run x = x
end

module Expect_test_config :
Expect_test_config_types.S
with module IO_run = Lwt_io_run
and module IO_flush = Lwt_io_flush = struct
module IO_run = Lwt_io_run
module IO_flush = Lwt_io_flush
module Expect_test_config : Expect_test_config_types.S with module IO = Lwt_io = struct
module IO = Lwt_io

let run x = Lwt_main.run (x ())
let upon_unreleasable_issue = `CR
let sanitize id = id
end
#+end_src

Expand Down

0 comments on commit 68f03c8

Please sign in to comment.