I'm trying to write a test suite for a cabal project which builds an executable. I'd like the tests in the suite to run that particular executable, but I don't know where to find it (because my tests might be getting run from a sandbox in some unknown location).
Cabal ought to know where my project's executable is when it calls my test suite. Is there some way for my test module/program to gather this and other similar information from Cabal, perhaps with the new detailed-1.0
testing framework?
There's a "magic" module you can include in your cabal file to query the paths related to the project.
name: myproject
library
other-modules:
Paths_myproject
Exported by this module (import Paths_myproject
) are several FilePath
values which can be used to query the various paths Cabal uses when installing the project.
Paths_myproject.getBinDir
Paths_myproject.getDataDir
Paths_myproject.getDataFileName
Paths_myproject.getLibDir
Paths_myproject.getLibexecDir
Paths_myproject.getSysconfDir
Paths_myproject.version
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With