Doc tests using doctests-driver-gen
#1013
Closed
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.
This contributes:
DocTestsrunning these testsThis required me to:
doctestanddoctest-driver-gensrc:I cannot pass
.(where currently the library sits) todoctest, as this would pick up also theexes, and they all define moduleMain, which of course gives ambiguous module names and is not liked byghci.write-ghc-environment-files: alwaystocabal.project.Step 2. is maybe a big change, but it is in a single commit, so rebasing PRs should work (I rebased a bit back and forth over this commit locally, and it went fine). Putting the library in a subdir is the standard practice, so in the long run we have to do it at some point.
How to run the doctests:
The first step writes the
.ghc.environmentfile which is needed bycabal test.One could skip writing the environment file, but then it would need to be prefixed by
cabal exec:As usual, running
doctestis very slow (30 sec on my mac). I also trieddoctest-parallelin #1014 (https://github.com/haskell/hackage-server/blob/parallel-doctest/tests/DocTestMain.hs), but I didn't get it to work, and also it did not appear too much faster (17 sec getting to the point where it failed).