;cln: unittest.hs: remove bothersome PackageImports (#2337)
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.
This commit is contained in:
parent
f288a7d801
commit
5129a94bd7
@ -176,7 +176,6 @@ test-suite doctest
|
|||||||
type: exitcode-stdio-1.0
|
type: exitcode-stdio-1.0
|
||||||
main-is: doctests.hs
|
main-is: doctests.hs
|
||||||
hs-source-dirs:
|
hs-source-dirs:
|
||||||
./
|
|
||||||
test
|
test
|
||||||
ghc-options: -Wall -Wno-incomplete-uni-patterns -Wno-missing-signatures -Wno-orphans -Wno-type-defaults -Wno-unused-do-bind
|
ghc-options: -Wall -Wno-incomplete-uni-patterns -Wno-missing-signatures -Wno-orphans -Wno-type-defaults -Wno-unused-do-bind
|
||||||
build-depends:
|
build-depends:
|
||||||
@ -239,7 +238,6 @@ test-suite unittest
|
|||||||
type: exitcode-stdio-1.0
|
type: exitcode-stdio-1.0
|
||||||
main-is: unittest.hs
|
main-is: unittest.hs
|
||||||
hs-source-dirs:
|
hs-source-dirs:
|
||||||
./
|
|
||||||
test
|
test
|
||||||
ghc-options: -Wall -Wno-incomplete-uni-patterns -Wno-missing-signatures -Wno-orphans -Wno-type-defaults -Wno-unused-do-bind
|
ghc-options: -Wall -Wno-incomplete-uni-patterns -Wno-missing-signatures -Wno-orphans -Wno-type-defaults -Wno-unused-do-bind
|
||||||
build-depends:
|
build-depends:
|
||||||
|
|||||||
@ -115,10 +115,6 @@ when:
|
|||||||
# dependencies:
|
# dependencies:
|
||||||
# - ghc-debug-stub >=0.6.0.0 && <0.7
|
# - ghc-debug-stub >=0.6.0.0 && <0.7
|
||||||
|
|
||||||
source-dirs:
|
|
||||||
#- other/ledger-parse
|
|
||||||
- .
|
|
||||||
|
|
||||||
library:
|
library:
|
||||||
exposed-modules:
|
exposed-modules:
|
||||||
- Hledger
|
- Hledger
|
||||||
@ -186,6 +182,10 @@ library:
|
|||||||
- Text.WideString
|
- Text.WideString
|
||||||
# other-modules:
|
# other-modules:
|
||||||
# - Ledger.Parser.Text
|
# - Ledger.Parser.Text
|
||||||
|
source-dirs:
|
||||||
|
#- other/ledger-parse
|
||||||
|
- .
|
||||||
|
|
||||||
|
|
||||||
# "cabal test hledger-lib" currently fails, see doctest suite below
|
# "cabal test hledger-lib" currently fails, see doctest suite below
|
||||||
tests:
|
tests:
|
||||||
|
|||||||
@ -2,9 +2,7 @@
|
|||||||
Run the hledger-lib package's unit tests using the tasty test runner.
|
Run the hledger-lib package's unit tests using the tasty test runner.
|
||||||
-}
|
-}
|
||||||
|
|
||||||
-- package-qualified import to avoid cabal missing-home-modules warning (and double-building ?)
|
import Hledger (tests_Hledger)
|
||||||
{-# LANGUAGE PackageImports #-}
|
|
||||||
import "hledger-lib" Hledger (tests_Hledger)
|
|
||||||
import System.Environment (setEnv)
|
import System.Environment (setEnv)
|
||||||
import Test.Tasty (defaultMain)
|
import Test.Tasty (defaultMain)
|
||||||
|
|
||||||
|
|||||||
@ -3,9 +3,6 @@ Run the hledger package's unit tests using the tasty test runner
|
|||||||
(by running the test command limited to Hledger.Cli tests).
|
(by running the test command limited to Hledger.Cli tests).
|
||||||
-}
|
-}
|
||||||
|
|
||||||
-- cabal missing-home-modules workaround from hledger-lib, seems not needed here
|
|
||||||
-- {-# LANGUAGE PackageImports #-}
|
|
||||||
-- import "hledger" Hledger.Cli (tests_Hledger_Cli)
|
|
||||||
import Hledger.Cli (tests_Hledger_Cli)
|
import Hledger.Cli (tests_Hledger_Cli)
|
||||||
import System.Environment (setEnv)
|
import System.Environment (setEnv)
|
||||||
import Test.Tasty (defaultMain)
|
import Test.Tasty (defaultMain)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user