package spotlib

  1. Overview
  2. Docs
include module type of struct include Ppx_test.Test end

The test type

Test registration
val test_unit : Ppx_test.Location.t -> Ppx_test.Longident.t -> (unit -> unit) -> unit

Add a test of type unit -> unit. This is called when let %TEST_UNIT ppx phrase is called.

val test : Ppx_test.Location.t -> Ppx_test.Longident.t -> (unit -> bool) -> unit

Add a test of type unit -> bool. This is called when let %TEST ppx phrase is called.

val test_fail : Ppx_test.Location.t -> Ppx_test.Longident.t -> (unit -> unit) -> unit

Add a test of type unit -> unit. It must fail by raising an exception. This is called when let %TEST_FAIL ppx phrase is called.

Module opened in the test code
module TestTool = Ppx_test.Test.TestTool
Higher level API
val collect : unit -> unit

Run tests added by test, test_unit and add. Then it prints the report to stderr and exit. The exit status is 0 if there is no error, otherwise, 1.

This is for standalone test executables: it parses command line options using arg_specs to select tests to perform. All the tests are executed by default.

For application programs with integrated test interface, use run_tests instead.

Middle level APIs
module Name = Ppx_test.Test.Name
module Error = Ppx_test.Test.Error
module Result = Ppx_test.Test.Result
module Report = Ppx_test.Test.Report
val run_tests : bool -> Report.t

Run tests added by test, test_unit and add. It returns a report.

This is for application programs with integrated tests.

The boolean is to set the default value to perform each test or not. For test selections, applications must use arg_specs at its command line option parsing.

val arg_specs : (string * Arg.spec * string) list

Command line switches for testing options. Useful when integrating the tests into main applications instead of building independent test executables.

Lower level APIs
val add : t -> unit
val fun_ : (unit -> bool) -> t
val label : string -> t -> t
val ident : Ppx_test.Longident.t -> t -> t
val list : t list -> t
OCaml

Innovation. Community. Security.