-
Notifications
You must be signed in to change notification settings - Fork 467
Description
Desired Behavior
I'm writing some ("custom") tests run with dune and want naturally to use dune promote to update my expected results (which are stored in external files as my tested libraries are generated files).
As I have several files, I am currently doing the following:
(no-infer (progn
(diff expected/lex/actor.lex obtained/lex/actor.lex)
(diff expected/lex/basic.lex obtained/lex/basic.lex)
(diff expected/lex/cover.lex obtained/lex/cover.lex)
(diff expected/lex/empty_osc.lex obtained/lex/empty_osc.lex)
(diff expected/lex/enum.lex obtained/lex/enum.lex)
...
))And this file is updated by a script (to be changed by creating an executable to update it).
One limitation is that if many files differ, we need to promote, run the tests again, promote, run ...
The other issue is that diff with difference will stop the actions (and with-accepted-exit-codes does not support diff ).
It could be nice to have a way to be able to:
- compare directories (optionally with a "recursive option" like the
-rofdiff) - promote all the differences in a single run (with an individual confirmation for each difference and maybe an option to force promotion, like
dune promote --force)
We could also consider a promote alias to customize what dune promote could do.
Examples
We could add either one or both of the following actions:
diffn and diffn?
This would be a cross-over between progn and diff and could be used as such:
(no-infer (diffn
(expected/lex/actor.lex obtained/lex/actor.lex)
(expected/lex/basic.lex obtained/lex/basic.lex)
(expected/lex/cover.lex obtained/lex/cover.lex)
(expected/lex/empty_osc.lex obtained/lex/empty_osc.lex)
(expected/lex/enum.lex obtained/lex/enum.lex)
...
))The main advantage would be to allow promotion of all the differences with a single dune promote.
If this action is part of progn, we would continue to the next action only if no difference has been found.
diffd
This action would compare directories but there would be no inference of targets (so no need to have diffd?). We could have something like diffd+ to have recursive differences.
It could be used as such:
(diffd expected/ obtained/)This could also allow multiple promotion.
Cheers