require testpack; give better --verbose test output
This commit is contained in:
parent
2d42279cd3
commit
185168905e
24
Tests.hs
24
Tests.hs
@ -7,6 +7,7 @@ where
|
|||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
import Text.ParserCombinators.Parsec
|
import Text.ParserCombinators.Parsec
|
||||||
import Test.HUnit
|
import Test.HUnit
|
||||||
|
import Test.HUnit.Tools (assertRaises, runVerboseTests)
|
||||||
import Ledger
|
import Ledger
|
||||||
import Utils
|
import Utils
|
||||||
import Options
|
import Options
|
||||||
@ -15,19 +16,16 @@ import PrintCommand
|
|||||||
import RegisterCommand
|
import RegisterCommand
|
||||||
|
|
||||||
|
|
||||||
runtests opts args = do
|
runtests opts args = runner flattests
|
||||||
when (Verbose `elem` opts)
|
where
|
||||||
(do
|
runner | (Verbose `elem` opts) = runVerboseTests
|
||||||
putStrLn $ printf "Running %d tests%s:" n s
|
| otherwise = \t -> runTestTT t >>= return . (flip (,) 0)
|
||||||
sequence $ map (putStrLn . tname) $ tflatten flattests; putStrLn "Results:")
|
deeptests = tfilter matchname $ TestList tests
|
||||||
runTestTT flattests
|
flattests = TestList $ filter matchname $ concatMap tflatten tests
|
||||||
where
|
matchname = matchpats args . tname
|
||||||
deeptests = tfilter matchname $ TestList tests
|
n = length ts where (TestList ts) = flattests
|
||||||
flattests = TestList $ filter matchname $ concatMap tflatten tests
|
s | null args = ""
|
||||||
matchname = matchpats args . tname
|
| otherwise = printf " matching %s "
|
||||||
n = length ts where (TestList ts) = flattests
|
|
||||||
s | null args = ""
|
|
||||||
| otherwise = printf " matching %s "
|
|
||||||
(intercalate ", " $ map (printf "\"%s\"") args)
|
(intercalate ", " $ map (printf "\"%s\"") args)
|
||||||
|
|
||||||
-- test utils
|
-- test utils
|
||||||
|
|||||||
@ -33,7 +33,7 @@ Executable hledger
|
|||||||
|
|
||||||
Build-Depends: base, containers, haskell98, directory, parsec,
|
Build-Depends: base, containers, haskell98, directory, parsec,
|
||||||
regex-compat, regexpr>=0.5.1, old-locale, time,
|
regex-compat, regexpr>=0.5.1, old-locale, time,
|
||||||
HUnit, mtl, bytestring, filepath, process
|
HUnit, mtl, bytestring, filepath, process, testpack
|
||||||
|
|
||||||
Other-Modules: BalanceCommand
|
Other-Modules: BalanceCommand
|
||||||
Options
|
Options
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user