;re-enable doctest suite, with a workaround for cabal 3 (#1139)

This commit is contained in:
Simon Michael 2020-03-06 18:18:15 -08:00
parent c5779b00b1
commit 3565f49acf
3 changed files with 15 additions and 5 deletions

View File

@ -6,3 +6,14 @@ packages: hledger-lib
allow-newer:
brick:base
config-ini:containers
-- generate a ghc environment file, needed by doctest
-- (eg: ./.ghc.environment.x86_64-darwin-8.8.3).
-- cabal 3 doesn't write these by default.
-- https://github.com/simonmichael/hledger/issues/1139
-- https://github.com/sol/doctest/issues/245#issuecomment-583171683
-- cabal 2 doesn't understand this flag, but it's just a warning; should be ok.
-- cabal 3 still fails with doctest the first time; you have to run it
-- a second time. Hopefully in practice it won't fail, because of a
-- preceding cabal build.
write-ghc-environment-files: always

View File

@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash: 4f9a789b279703a75cecaf4e5cca835f20a5ddb9cfeb9e98e62db665a573d016
-- hash: 3d3dab519880fdc9325ef53cd2811154ab38f1e15f6e59e3d0b2b1c935d40337
name: hledger-lib
version: 1.17.0.1
@ -199,7 +199,6 @@ test-suite doctest
, transformers >=0.2
, uglymemo
, utf8-string >=0.3.5
buildable: False
if (impl(ghc < 8.2))
buildable: False
default-language: Haskell2010

View File

@ -164,10 +164,10 @@ tests:
dependencies:
- hledger-lib
# Running this test suite with cabal requires cabal exec:
# cabal exec -- cabal test hledger-lib:test:doctest
# Note when run by cabal, doctest requires a ghc environment file,
# so we ensure this is generated, see cabal.project.
# https://github.com/simonmichael/hledger/issues/1139
doctest:
buildable: false # doesn't run with cabal test, https://github.com/simonmichael/hledger/issues/1139
source-dirs: test
main: doctests.hs # can't call it doctest.hs ("File name does not match module name")
other-modules: [] # prevent double compilation, https://github.com/sol/hpack/issues/188