I am pleased to introduce the UnifiedScript_Std and UnifiedScript_Top packages. Unified scripts are a way to write tests and documentation simultaneously. Cram tests and MDX scripts are both similar to unified scripts, but unified scripts aren’t tied to Markdown (MDX) or tied to POSIX shell commands (cram tests).
Examples:
- Markdown example: Here are the zillions of tests from
ocaml-reconverted into Markdown: ocaml-re/EXAMPLES.md. Custom OCaml REPL printers are used so that many of the tests are printed as Markdown tables. aside: Wouldn’t it be nice if tests you are already writing became documentation? That was a 4 year follow-up to What are the biggest reasons newcomers give up on OCaml? - #13 by jbeckford)
-
.mlexample: The following is a snippet from a regular OCaml.mlmodule where the(* ... *)comments are OCaml REPL toplevel responses maintained by the unified tools.let lyrics = "Everybody step to the left." (* val lyrics : string = "Everybody step to the left." *)[@ocamlformat "disable"] let (_ : string) = Printf.sprintf "Now let's sing: %s" lyrics (* - : string = "Now let's sing: Everybody step to the left." *)[@ocamlformat "disable"]
Docs are at dk/docs/UNIFIED_SCRIPTS.md (of course generated by the unified tools).
Install the tools with:
opam pin add UnifiedScript_Std https://gitlab.com/dkml/build-tools/MlFront/-/releases/permalink/latest/downloads/MlFront.tar.gz
opam pin add UnifiedScript_Top https://gitlab.com/dkml/build-tools/MlFront/-/releases/permalink/latest/downloads/MlFront.tar.gz
After feedback I’ll release them officially to opam. I would like feedback overall and also specifically on the agent skill that converts expect tests to unified tests.