For a project I’m working on right now, I’m curious how people would suggest going about testing ocaml-migrate-parsetree. At first blush, it seems a little complicated:
- one doesn’t want to write down a gazillion AST expressions – that’d be incredibly tedious.
- is fuzz-testing sufficient? These are big, complicated types.
- using the ocaml parser seems difficult: it changes from version-to-version, and it seems unlikely that you can copy the ocaml 4.02 parser to ocaml 4.11 and expect it to even compile.
Anyway, just curious.
ETA: Looking at the code, I don’t see copious tests, which is why I wondered.
You can mostly copy the OCaml 4.02 parser to OCaml 4.11 and it will compile, there isn’t that many breaking changes in the OCaml on userspace.
I can easily imagine doing so for one version of the parser. To do so for ten versions, is a little more work. [ETA: gotta copy over the lexer and get that working, too.] And then of course, there’s the problem of the minor fixes to get each such parser working, etc. You start putting a lot of work into it, and now you have to test your test apparatus to have any confidence in it, yes?
I’m just wondering what an effective testing strategy would be … and it seems like, there isn’t any good one.
ETA: If the answer is: “the type system should be sufficient to ensure that errors don’t occur” then, sure, I buy that argument. I’m just wondering what the actual testing assumptions are.