[pre-ANN-RFC] TestExtras.jl

In one of my packages, I often wanted to test for type stability and inferrability of the return type, but while relying on the mechanism of constant propagation. Unfortunately this is not covered by Test.@inferred, so I decided to write my own adaption of that macro. Not only does it deal with constant propagation, the successful or failed inference also contributes to the actual passed or failed test count, rather than just throwing a generic error.

Another addition to the standard library Test that I wanted is a TestSet type that records the total execution time of a given testset.

I’ve now wrapped up both functionalities in the (not-yet-registered) package TestExtras.jl. Before registering this, I wanted to probe

  • whether there is some general interest in this functionality,
  • whether this could benefit from being moved to some more central Julia organisation,
  • whether there are other common additions to the standard Test library that people use, have implemented or want to see, and if so, if there is any interest in bundling them together in this package, or a similar package with a different name,
  • whether this could in time be considered as a PR to Test?
1 Like

FYI, I recently stumbled on a PR about this that was never implemented. Not sure what the problem was with that PR, but I’d definitely be interested in a version of @inferred that contributes to the test count.

Thanks for the pointer @ric.cioffi . That’s slightly different (as it returns the result of the inference tests as a Bool) but indeed very similar in underlying motivation/goal. I’ve posted a small note in that PR to also point out the current possibility.

@helgee, thanks for the link. Maybe there is some interest with @YingboMa to join our efforts and have all functionality together in one package?