realworldocaml / mdx

Execute code blocks inside your documentation
ISC License
269 stars 45 forks source link

mdx_test: Lazily initialize OCaml toplevel #376

Open bcc32 opened 2 years ago

bcc32 commented 2 years ago

This changes the OCaml toplevel to be a lazy value, which is only forced when needed to run tests in an OCaml block.

The motivation behind this change is to avoid stderr output from the init process (e.g., errors while registering pretty-printers) spilling into the test executable's output, which can trip up some build tools.