Skip to content

Configurable functions to test impure code

License

Notifications You must be signed in to change notification settings

cryptosense/ocaml-mock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mock - configurable functions to test impure code

Build Status Documentation

This package provides "mocks", fake functions that can be configured to return values or raise exceptions. 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 OUnit is available as mock-ounit.