Open ksromanov opened 5 years ago
There is actually a plan for this :)
ppxlib has an infrastructure for ppx rewriters to output additional information that could be useful to the build system. For instance, if you run ppx-jane -output-metadata /tmp/meta file_with_tests.ml
(after installing ppx_jane
), you will see that /file/meta
contains a field saying that file_with_tests
has tests.
Dune could then use this information to warn the user if ml files have tests but they forgot to put the inline_tests
field. It could also use it for optimisation purposes.
I have been meaning to wire things up, but never really found the time to do it.
I am not sure if it is really possible to fix, or it is one of the design constrains. Please fill free to close with
Will-Not-Fix
.While exploring
ppx_custom_printf
rewriter, I found thatdune build @runtest
command does almost nothing for this package (checked withstrace
). However, tests are written. Quite soon, it revealed thattest/dune
file missed mandatoryinline_tests
stanza. See https://github.com/janestreet/ppx_custom_printf/issues/5The problem is that tests were silently ignored. So, the developer would think mistakenly that they have passed (after fix they passed indeed).
I don't think that there is a good solution for this problem. But, as a semi-solution
dune
can warn, if absolutely no tests were executed forruntest
target. This definitely will not hurt.Or, may be,
dune
can dump the list of executed tests? Painted in emerald green, of course.