package tezos-test-services

  1. Overview
  2. Docs

test_services collects Alcotest testable definitions for base OCaml types and Tezos specific types.

include module type of struct include Alcotest end
exception Test_error
include module type of struct include Test_services_base end
include module type of struct include Alcotest end
type return = unit
type speed_level = [
  1. | `Quick
  2. | `Slow
]
type !'a test_case = string * speed_level * ('a -> return)
exception Test_error
val test_case : string -> speed_level -> ('a -> return) -> 'a test_case
type !'a test = string * 'a test_case list
type !'a with_options = ?stdout:Alcotest_engine__.Formatters.stdout -> ?stderr:Alcotest_engine__.Formatters.stderr -> ?and_exit:bool -> ?verbose:bool -> ?compact:bool -> ?tail_errors:[ `Limit of int | `Unlimited ] -> ?quick_only:bool -> ?show_errors:bool -> ?json:bool -> ?filter:(name:string -> index:int -> [ `Run | `Skip ]) -> ?log_dir:string -> ?bail:bool -> ?record_backtrace:bool -> ?ci:Alcotest_engine__.Config.ci -> 'a
val run : (?argv:string array -> string -> unit test list -> return) with_options
val run_with_args : (?argv:string array -> string -> 'a Cmdliner.Term.t -> 'a test list -> return) with_options
module type TESTABLE = Test_services_base.TESTABLE
type !'a testable = (module TESTABLE with type t = 'a)
val testable : 'a Fmt.t -> ('a -> 'a -> bool) -> 'a testable
val pp : 'a testable -> 'a Fmt.t
val equal : 'a testable -> 'a -> 'a -> bool
val bool : bool testable
val int : int testable
val int32 : int32 testable
val int64 : int64 testable
val float : float -> float testable
val char : char testable
val string : string testable
val bytes : bytes testable
val unit : unit testable
val list : 'a testable -> 'a list testable
val slist : 'a testable -> ('a -> 'a -> int) -> 'a list testable
val array : 'a testable -> 'a array testable
val option : 'a testable -> 'a option testable
val result : 'a testable -> 'e testable -> ('a, 'e) Stdlib.result testable
val pair : 'a testable -> 'b testable -> ('a * 'b) testable
val triple : 'a testable -> 'b testable -> 'c testable -> ('a * 'b * 'c) testable
val of_pp : 'a Fmt.t -> 'a testable
val pass : 'a testable
val reject : 'a testable
val neg : 'a testable -> 'a testable
module Source_code_position = Test_services_base.Source_code_position
type !'a extra_info = ?here:Source_code_position.here -> ?pos:Source_code_position.pos -> 'a
val check : ('a testable -> string -> 'a -> 'a -> unit) extra_info
val check' : ('a testable -> msg:string -> expected:'a -> actual:'a -> unit) extra_info
val fail : (string -> 'a) extra_info
val failf : (('a, Stdlib.Format.formatter, unit, 'b) Stdlib.format4 -> 'a) extra_info
val check_raises : (string -> exn -> (unit -> unit) -> unit) extra_info
val match_raises : (string -> (exn -> bool) -> (unit -> unit) -> unit) extra_info
val skip : unit -> 'a
module Unix_platform = Test_services_base.Unix_platform
val exn : exn testable
val map : ('b -> 'a) -> 'a testable -> 'b testable
val pair3 : ('a * ('b * 'c)) testable -> ('a * 'b * 'c) testable
val pair4 : ('a * ('b * ('c * 'd))) testable -> ('a * 'b * 'c * 'd) testable
val tuple3 : 'a testable -> 'b testable -> 'c testable -> ('a * 'b * 'c) testable
val tuple4 : 'a testable -> 'b testable -> 'c testable -> 'd testable -> ('a * 'b * 'c * 'd) testable
val assert_true : string -> bool -> unit
val assert_false : string -> bool -> unit
val impossible : string -> unit
val lwt_assert_true : string -> bool -> unit Lwt.t
val lwt_assert_false : string -> bool -> unit Lwt.t
val lwt_check : 'a Alcotest.testable -> string -> 'a -> 'a -> unit Lwt.t
val lwt_impossible : string -> unit Lwt.t
val lwt_fail : string -> unit Lwt.t
val lwt_assert_catch : (unit -> unit Lwt.t) -> exn -> unit Lwt.t
val contains : 'a testable -> string -> 'a -> 'a list -> unit
val tzresults : 'a testable -> ('a, Tezos_error_monad.TzCore.error list) Stdlib.result testable
val p2p_peer_id : Tezos_base.P2p_peer.Id.t Alcotest.testable
val tztest : string -> Alcotest.speed_level -> (unit -> (unit, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t) -> unit Alcotest_lwt.test_case

Transorm a function running in the error monad into an Alcotest, taking care of failing the test if the function results is an error. Note that the given function must still take care of test assertions.

module Alcotest_extra : sig ... end
module Mock_sink : sig ... end
val with_empty_mock_sink : (unit -> unit Lwt.t) -> unit Lwt.t

with_empty_mock_sink f executes f after activating or clearing a Mock_sink sink.

Sinks can only be registered and activated once, and not removed thereafter.

OCaml

Innovation. Community. Security.