package alcotest-lwt
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=dcbadd1c70956d013feb236dc7ae1e6ed11d30c0f0cde999ff26bc0c94238051
md5=771277ef1fe21b17920b5b44acf441b3
Description
Alcotest exposes simple interface to perform unit tests. It exposes
a simple TESTABLE
module type, a check
function to assert test
predicates and a run
function to perform a list of unit -> unit
test callbacks.
Alcotest provides a quiet and colorful output where only faulty runs are fully displayed at the end of the run (with the full logs ready to inspect), with a simple (yet expressive) query language to select the tests to run.
Published: 05 Sep 2017
README
Alcotest is a lightweight and colourful test framework.
Alcotest exposes simple interface to perform unit tests. It exposes a simple TESTABLE
module type, a check
function to assert test predicates and a run
function to perform a list of unit -> unit
test callbacks.
Alcotest provides a quiet and colorful output where only faulty runs are fully displayed at the end of the run (with the full logs ready to inspect), with a simple (yet expressive) query language to select the tests to run.
Examples
A simple example:
(* Build with `ocamlbuild -pkg alcotest simple.byte` *)
(* A module with functions to test *)
module To_test = struct
let capit letter = Char.uppercase letter
let plus int_list = List.fold_left (fun a b -> a + b) 0 int_list
end
(* The tests *)
let capit () =
Alcotest.(check char) "same chars" 'A' (To_test.capit 'a')
let plus () =
Alcotest.(check int) "same ints" 7 (To_test.plus [1;1;2;3])
let test_set = [
"Capitalize" , `Quick, capit;
"Add entries", `Slow , plus ;
]
(* Run it *)
let () =
Alcotest.run "My first test" [
"test_set", test_set;
]
The result is a self-contained binary which displays the test results. Use ./simple.byte --help
to see the runtime options.
$ ./simple.native
[OK] test_set 0 Capitalize.
[OK] test_set 1 Add entries.
Test Successful in 0.001s. 2 tests run.
See the examples folder for more examples.
Dev Dependencies
None
Used by (54)
- ambient-context-eio
- ambient-context-lwt
- azure-cosmos-db
-
capnp-rpc-lwt
= "0.3"
-
capnp-rpc-mirage
< "0.6.0"
-
capnp-rpc-unix
>= "0.3.1" & < "0.6.0"
-
current
< "0.2"
- equinoxe
- equinoxe-cohttp
- equinoxe-hlc
-
gitlab-unix
< "0.1.1"
- guardian
-
http-mirage-client
< "0.0.7"
-
irmin
>= "2.4.0"
- irmin-containers
-
irmin-pack
!= "2.3.0" & != "2.6.1"
-
ledgerwallet-tezos
>= "0.4.0"
-
mirage-block-partition
< "0.2.0"
-
mirage-vnetif-stack
< "0.6.1"
- multipart_form-lwt
-
nbd
>= "4.0.3"
- nbd-tool
-
nbd-unix
< "6.0.1"
-
obuilder
< "0.6.0"
-
opium
>= "0.19.0"
- opium-graphql
- opium-testing
- otoggl
- paf
-
paf-cohttp
< "0.5.0"
-
piaf
< "0.2.0"
-
prometheus-app
>= "1.2"
-
resp-unix
< "0.10.0"
-
rpc
>= "5.9.0" & < "7.1.0"
- rpclib-lwt
-
SZXX
< "4.0.0"
- server-reason-react
- terminus
- terminus-cohttp
- terminus-hlc
- tezos-008-PtEdo2Zk-test-helpers
- tezos-009-PsFLoren-test-helpers
- tezos-010-PtGRANAD-test-helpers
-
tezos-alpha-test-helpers
< "12.0"
-
tezos-baking-011-PtHangz2
>= "12.0"
-
tezos-baking-012-Psithaca
< "13.0"
-
tezos-baking-alpha
>= "12.0" & < "13.0"
-
tezos-mockup
>= "10.2" & < "13.0"
-
tezos-protocol-plugin-012-Psithaca
< "13.0"
-
tezos-rpc-http-server
>= "10.2" & < "13.0"
-
tezos-shell-services
>= "11.0" & < "13.0"
-
tezos-test-helpers
< "11.0"
-
tezos-test-services
< "9.2"
- universal-portal
Conflicts
None