package webtest

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

Types and functions for creating and structuring unit test suites.

exception TestFailure of string

The exception thrown by failing tests.

type result =
  1. | Error of exn
    (*

    An unexpected error occurred in the test.

    *)
  2. | Fail of string
    (*

    An assertion failed in the test.

    *)
  3. | Pass
    (*

    The test passed.

    *)

The result of running a single testcase.

module Sync : sig ... end
module Async : sig ... end
type t =
  1. | TestCase of string * Async.test_fun
    (*

    A labelled single test.

    *)
  2. | TestList of string * t list
    (*

    A labelled list of tests.

    *)

A labelled wrapper around a test or list of suites.

val (>::) : string -> Sync.test_fun -> t

Convenience function to create a suite from a label and a Sync.test_fun.

val (>:~) : string -> Async.test_fun -> t

Convenience function to create a suite from a label and a Sync.test_fun.

Convenience function to create a suite from a label and an Async.test_fun.

val (>:::) : string -> t list -> t

Convenience function to create a suite from a label and an Async.test_fun.

Convenience function to create a suite from a label and a list of suites.

val assert_true : ?label:string -> bool -> unit

assert_bool label value returns unit if value is true, and otherwise raises TestFailure.

val assert_equal : ?equal:('a -> 'a -> bool) -> ?label:string -> ?printer:('a -> string) -> 'a -> 'a -> unit

assert_equal a b returns unit if a is equal to b, and otherwise raises TestFailure.

val assert_raises : ?label:string -> exn -> (unit -> unit) -> unit

assert_raises e task returns unit if task () raises e, and otherwise raises TestFailure.

val assert_raises_string : ?label:string -> string -> (unit -> unit) -> unit

assert_raises_string str task returns unit if task () raises an exception e for which Printexc.to_string e = str, and otherwise raises TestFailure.

OCaml

Innovation. Community. Security.