[ANN] UnifiedScript_{Std,Top} - literate testing

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:

  • .ml example: The following is a snippet from a regular OCaml .ml module 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.

2 Likes