;tests: re-add hledger-lib's tests to the cabal file, as unittests

This commit is contained in:
Simon Michael 2019-11-28 14:45:10 -08:00
parent daab432a29
commit ca4fade4af
4 changed files with 70 additions and 13 deletions

View File

@ -419,8 +419,8 @@ pkgtest: $(call def-help,pkgtest, run the test suites in each package )
doctest: $(call def-help,doctest, run the doctests in hledger-lib module/function docs )
@($(STACKTEST) hledger-lib:test:doctests && echo $@ PASSED) || (echo $@ FAILED; false)
easytest: $(call def-help,easytest, run the easytest unit tests in hledger-lib )
@($(STACKTEST) hledger-lib:test:easytests && echo $@ PASSED) || (echo $@ FAILED; false)
unittest: $(call def-help,unittest, run the unit tests in hledger-lib )
@($(STACKTEST) hledger-lib:test:unittests && echo $@ PASSED) || (echo $@ FAILED; false)
# assumes an up to date hledger executable is built.
# I think we don't do it automatically to minimise unnecessary rebuilding.

View File

@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash: f8ee8c9fd0412cc0a8cd5c6286b7ef4f9a33ae2a30989dfc0b99c3f79bd55622
-- hash: d44cc48a2f9dc087afe19992824ce4e95ddf82662880f81963eb6389a5ef4a83
name: hledger-lib
version: 1.15.99
@ -206,3 +206,59 @@ test-suite doctests
if (impl(ghc < 8.2))
buildable: False
default-language: Haskell2010
test-suite unittests
type: exitcode-stdio-1.0
main-is: unittests.hs
hs-source-dirs:
./.
test
ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-orphans
build-depends:
Decimal
, Glob >=0.9
, ansi-terminal >=0.6.2.3
, array
, base >=4.9 && <4.14
, base-compat-batteries >=0.10.1 && <0.12
, blaze-markup >=0.5.1
, bytestring
, call-stack
, cassava
, cassava-megaparsec
, cmdargs >=0.10
, containers
, data-default >=0.5
, deepseq
, directory
, extra >=1.6.3
, fgl >=5.5.4.0
, file-embed >=0.0.10
, filepath
, hashtables >=1.2.3.1
, hledger-lib
, megaparsec >=7.0.0 && <8
, mtl
, mtl-compat
, old-time
, parsec >=3
, parser-combinators >=0.4.0
, pretty-show >=1.6.4
, regex-tdfa
, safe >=0.2
, split >=0.1
, tabular >=0.2
, tasty >=1.2.3
, tasty-hunit >=0.10.0.2
, template-haskell
, text >=1.2
, time >=1.5
, timeit
, transformers >=0.2
, uglymemo
, utf8-string >=0.3.5
buildable: True
if (!impl(ghc >= 8.0))
build-depends:
semigroups ==0.18.*
default-language: Haskell2010

View File

@ -186,11 +186,10 @@ tests:
- condition: (impl(ghc < 8.2))
buildable: false
# easytests:
# buildable: true
# source-dirs: test
# main: easytests.hs
# other-modules: [] # prevent double compilation, https://github.com/sol/hpack/issues/188
# dependencies:
# - hledger-lib
unittests:
buildable: true
source-dirs: test
main: unittests.hs
other-modules: [] # prevent double compilation, https://github.com/sol/hpack/issues/188
dependencies:
- hledger-lib

View File

@ -1,8 +1,10 @@
{-# LANGUAGE PackageImports #-}
{-
Run hledger-lib's easytest tests using the easytest runner.
Run hledger-lib's unit tests using tasty's test runner.
Note that we use package-qualified import to overcome
Cabal heuristic missing-home-modules.
-}
import "hledger-lib" Hledger
main = run tests_Hledger
import Test.Tasty (defaultMain)
main = defaultMain tests_Hledger