package mock-ounit

  1. Overview
  2. Docs
Configurable functions to test impure code

Install

Dune Dependency

Authors

Maintainers

Sources

mock-0.1.0.tbz
sha256=cbc52786edcaebce9f86a366b65bc0d6d646ec667e40837846de241ae44efb40
md5=f5a6529d2df5aa1789846c902028cd1c

Description

This package provides "mocks", fake functions that can be configured to return values or raise exception. It is possible to inspect their arguments after their execution. The API is greatly inspired by unittest.mock in Python.

There is no magic under the hood, it is "just" a reference to a function, but it makes it possible to have pleasant output like this in your tests:

expected f to be called once, but it was called 3 times

A wrapper for OUnit2 is available as mock-ounit.

Published: 17 Mar 2018

README

Mock - configurable functions to test impure code

This package provides "mocks", fake functions that can be configured to return values or raise exception. It is possible to inspect their arguments after their execution. The API is greatly inspired by unittest.mock in Python.

There is no magic under the hood, it is "just" a reference to a function, but it makes it possible to have pleasant output like this in your tests:

A wrapper for OUnit2 is available as mock-ounit.

Dependencies (4)

  1. ounit
  2. mock
  3. jbuilder >= "1.0+beta10"
  4. ocaml

Dev Dependencies

None

Used by (1)

  1. zeit

Conflicts

None

OCaml

Innovation. Community. Security.