doctest icon indicating copy to clipboard operation
doctest copied to clipboard

How to keep tests working across package versions?

Open jsermeno opened this issue 8 years ago • 1 comments

Hi,

What's the best way to keep tests working when a package changes its Show instance? vector for example recently changed the way they display a vector. Is the only way to use cpp pre-processor statements? It might be cool if there was an "or" operator. For what's it worth it would solve my use case if ... matched the empty string as well, though it might be that the best way forward it to convert the test into a unit test.

Alternatively, is there a way to ignore a doctest? So that you could keep the test for documentation, while still running other doctests in the same file.

Thanks

jsermeno avatar Nov 21 '16 22:11 jsermeno

@jsermeno I don't have a good solution here. If you are actually testing your code (rather than using Doctest to make sure that examples in your documentation do actually work), then yes, converting to unit tests is the way to go.

On the other hand, if you actually want to test documentation, one solution may be to only run Doctest for the latest version of GHC with all the latest dependencies. Even though this is not a perfect solution, it may still give you reasonable confidence that your code examples work.

sol avatar Apr 11 '17 03:04 sol