aboutsummaryrefslogtreecommitdiff
path: root/shell.nix
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-02-02 17:09:16 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2021-02-02 20:36:51 -0800
commit2415b2680a522e89b63abb370c02bfff54b824a2 (patch)
treed9a808794626c82c968334af97e51505d701ff22 /shell.nix
parentec8509295a8de19462ecd352a22b2784158e9ec6 (diff)
downloadpandoc-2415b2680a522e89b63abb370c02bfff54b824a2.tar.gz
Test suite: a more robust way of testing the executable.
Mmny of our tests require running the pandoc executable. This is problematic for a few different reasons. First, cabal-install will sometimes run the test suite after building the library but before building the executable, which means the executable isn't in place for the tests. One can work around that by first building, then building and running the tests, but that's fragile. Second, we have to find the executable. So far, we've done that using a function findPandoc that attempts to locate it relative to the test executable (which can be located using findExecutablePath). But the logic here is delicate and work with every combination of options. To solve both problems, we add an `--emulate` option to the `test-pandoc` executable. When `--emulate` occurs as the first argument passed to `test-pandoc`, the program simply emulates the regular pandoc executable, using the rest of the arguments (after `--emulate`). Thus, test-pandoc --emulate -f markdown -t latex is just like pandoc -f markdown -t latex Since all the work is done by library functions, implementing this emulation just takes a couple lines of code and should be entirely reliable. With this change, we can test the pandoc executable by running the test program itself (locatable using findExecutablePath) with the `--emulate` option. This removes the need for the fragile `findPandoc` step, and it means we can run our integration tests even when we're just building the library, not the executable. Part of this change involved simplifying some complex handling to set environment variables for dynamic library paths. I have tested a build with `--enable-dynamic-executable`, and it works, but further testing may be needed.
Diffstat (limited to 'shell.nix')
0 files changed, 0 insertions, 0 deletions