realworldocaml / mdx

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

New release with 5.1 compatibility #438

Open mseri opened 11 months ago

mseri commented 11 months ago

Would it be possible to have a release of mdx with https://github.com/realworldocaml/mdx/pull/435 ? This would re-enable testing for a number of packages that where otherwise failing (and now are not tested due to newly introced upper bounds, see https://github.com/ocaml/opam-repository/pull/24467)

polytypic commented 11 months ago

Currently mdx depends on the compiler internals and, as it is, mdx will also require updates to work with OCaml 5.2, so this problem is going to repeat soon.

I would personally recommend to

mseri commented 11 months ago

Thanks for the comment. Ping @talex5

mseri commented 11 months ago

I support your first point. I think for the latter is too late, since many projects are now using mdx to use the documentation also as a testing tool

polytypic commented 11 months ago

The mdx tool, as it is, requires constant maintenance to keep up with the compiler internals and mdx is not, to my knowledge, currently actively maintained. Perhaps this changes in the future, but for now I personally do not recommend using mdx as a testing tool.

As long as software is being maintained, it should not be too late to rewrite tests to use less fragile and maintenance heavy approaches.

tmattio commented 11 months ago

PR on opam-repository is at https://github.com/ocaml/opam-repository/pull/24535

tmattio commented 11 months ago

To comment on

stop using mdx as a critical testing tool and only use it to optionally check documentation.

Now that Dune supports cram test and that cram test support has been removed from mdx, the tool's primary purpose is indeed to run code blocks in documentation, and not to be a test runner.

I've been curious about that: is there anything blocking Eio from using Dune cram tests in place of mdx?

talex5 commented 11 months ago

Eio will always have documentation, so it always needs to depend on a doc tester like mdx. So having a second testing system doesn't make things any more reliable, and cram tests look less convenient that mdx. What's the benefit?

tmcgilchrist commented 9 months ago

To comment on

stop using mdx as a critical testing tool and only use it to optionally check documentation.

Now that Dune supports cram test and that cram test support has been removed from mdx, the tool's primary purpose is indeed to run code blocks in documentation, and not to be a test runner.

What is confusing in my opinion is craml is marked as deprecated and I'm directed to use mdx instead. The cram tests documentation for dune doesn't mention any deprecation, I can only assume because it uses something else? But it's not clear whether it is.

I can create the equivalent documentation tests in mdx and they work the same as the dune cram tests.

So which supported option should I use to test cli ocaml programs?

KFoxder commented 6 months ago

@tmcgilchrist As someone who is new and just finally stumbled to this issue and comment. I agree. I was quite confused and thought I should be using mdx only to find out that craml is not deprecated and is in fact part of dune