From d0fe2de0843397d8c7b86e4cb483636743fc6564 Mon Sep 17 00:00:00 2001 From: Jason Conroy Date: Sat, 10 Jan 2026 17:35:36 -0500 Subject: [PATCH] gnu: ocaml5: Add ocaml-alcotest. * gnu/packages/ocaml5.scm (ocaml-alcotest): New variable. Change-Id: I65956e9fe85e5f1bd99ea48a2a711bee3b26641b Signed-off-by: Julien Lepiller --- gnu/packages/ocaml5.scm | 44 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/gnu/packages/ocaml5.scm b/gnu/packages/ocaml5.scm index a6572a580e9..84959f4670c 100644 --- a/gnu/packages/ocaml5.scm +++ b/gnu/packages/ocaml5.scm @@ -696,6 +696,50 @@ other XUnit testing frameworks.") @end enumerate") (license license:expat))) +(define-public ocaml-alcotest + (package + (name "ocaml5-alcotest") + (version "1.9.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/mirage/alcotest") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 "1a8ljwmbm7yp9kvfpfg1153amg7f54gh8jnmv485bhs8am1m0w7c")))) + (build-system dune-build-system) + (arguments + `(#:package "alcotest" + #:phases (modify-phases %standard-phases + (add-after 'unpack 'fix-test-format + (lambda _ + ;; cmdliner changed the format and the tests fail + (substitute* "test/e2e/alcotest/failing/unknown_option.expected" + (("`") + "'") + (("\\.\\.\\.") + "…"))))))) + (native-inputs (list ocamlbuild)) + (propagated-inputs (list ocaml-astring + ocaml-cmdliner + ocaml-fmt + ocaml-re + ocaml-stdlib-shims + ocaml-uuidm + ocaml-uutf)) + (home-page "https://github.com/mirage/alcotest") + (synopsis "Lightweight OCaml test framework") + (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.") + (license license:isc))) + (define-public ocaml5.3-dune-bootstrap (package (name "ocaml5.3-dune")