Expect tests for generated code in examples/ #230
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello team,
Following our discussion in issue #204 , I've made a small adjustment to the testing workflow. This is a minor change, but I believe it could reveal beneficial.
Here's what's been done:
Expect Tests: For each
ml
andmli
file generated by a dune rule in thesrc/examples/
directory, corresponding*.ml.expected
and*.mli.expected
files have been added. This will help us keep track of the impact of PRs on the generated code.Dune Rule: A dune rule has been added to diff the generated files against their expected reference as part of
dune @runtest
. In case the generated code changes, updating the expect files is straightforward. You just need to rundune promote
, and the expect files will be updated by dune to match the new output.This change doesn't introduce any new dependencies or affect the non-testing code. It's a small step towards continuing to improve on the existing testing workflow.
I find that it can be hard to know beforehand whether this new test setup will add undue friction. If in practice, this change doesn't work as well as I hope, it can easily be reverted without impacting the rest of the code.
Looking forward to your feedback.