When running `cd hledger-lib && ghci test/unittest.hs`, ghci complains
with:
```
test/unittest.hs:7:1: error:
Could not find module ‘Hledger’
It is not a module in the current program, or in any known package.
|
7 | import "hledger-lib" Hledger (tests_Hledger)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Failed, no modules loaded.
```
This commit removes the "hledger-lib" package-qualified import, such
that above ghci command works as expected.
However, there is a comment in hledger-lib/test/unittest.hs that says:
> package-qualified import to avoid cabal missing-home-modules warning
> (and double-building ?)
The missing-home-modules warning and the double building can indeed be
reproduced by running (after removing the "hledger-lib"
package-qualified import): `cd hledger-lib && cabal build unittest`. It
will first build `hledger-lib`, then show a warning about
missing-home-modules, and then build `hledger-lib` again.
After comparing the unittest sections of hledger.cabal and
hledger-lib.cabal, the solution turned out to be to remove `./` from
hs-source-dirs for unittest. Don't ask me why though!
Overall it's a nice cleanup.
14 lines
324 B
Haskell
14 lines
324 B
Haskell
{-
|
|
Run the hledger-lib package's unit tests using the tasty test runner.
|
|
-}
|
|
|
|
import Hledger (tests_Hledger)
|
|
import System.Environment (setEnv)
|
|
import Test.Tasty (defaultMain)
|
|
|
|
main :: IO ()
|
|
main = do
|
|
setEnv "TASTY_HIDE_SUCCESSES" "true"
|
|
setEnv "TASTY_ANSI_TRICKS" "false" -- helps the above
|
|
defaultMain tests_Hledger
|