| Did you know ... | Search Documentation: |
| Packs (add-ons) for SWI-Prolog |
| Title: | Doctests using PlDoc and PlUnit |
|---|---|
| Rating: | Not rated. Create the first rating! |
| Latest version: | 1.3.2 |
| SHA1 sum: | 19d8739c65bb6b645a8001aef4c200c636e69a09 |
| Author: | Sylvain Soliman <Sylvain.Soliman@inria.fr> |
| Home page: | https://gitlab.inria.fr/soliman/doctest/ |
| Download URL: | https://soliman.gitlabpages.inria.fr/doctest/doctest-*.zip |
No reviews. Create the first review!.
 
Generate PlUnit tests from queries in the PlDoc documentation of your module.
Be careful, this uses (and will run) the queries only (identified by ?- ) and not the documented answers (it will instead identify all answers/errors/etc. thanks to the test_wizard library) unless you use the parse_output(true) option.
However that option currently will not properly recognize exception messagesâ¦
In all cases, if your queries call use_module, or print some output via write they will probably crash the parser.
To avoid this, use indented code blocks, these will be safely ignored.
The current handling of errors is⦠work in progress ;)
swipl pack install doctest
?- use_module(library(doctest)).
?- gen_doctests('input.pl', [outfile('output.plt')]).
You can access this package's PlDoc at https://soliman.gitlabpages.inria.fr/doctest/prolog/doctest.html
Pack contains 8 files holding a total of 11.3K bytes.