add a --verbose/-v flag, use it to show more test-running detail
This commit is contained in:
parent
f3f74cb64f
commit
565feb594e
@ -38,6 +38,7 @@ options = [
|
||||
Option ['n'] ["collapse"] (NoArg Collapse) "balance report: no grand total",
|
||||
Option ['s'] ["subtotal"] (NoArg SubTotal) "balance report: show subaccounts",
|
||||
Option ['h'] ["help"] (NoArg Help) "show this help",
|
||||
Option ['v'] ["verbose"] (NoArg Verbose) "verbose test output",
|
||||
Option ['V'] ["version"] (NoArg Version) "show version"
|
||||
]
|
||||
|
||||
@ -54,6 +55,7 @@ data Opt =
|
||||
Collapse |
|
||||
SubTotal |
|
||||
Help |
|
||||
Verbose |
|
||||
Version
|
||||
deriving (Show,Eq)
|
||||
|
||||
|
||||
7
Tests.hs
7
Tests.hs
@ -11,8 +11,11 @@ import PrintCommand
|
||||
import RegisterCommand
|
||||
|
||||
|
||||
runtests args = do
|
||||
putStrLn $ printf "Running %d tests%s ..\n" n s
|
||||
runtests opts args = do
|
||||
when (Verbose `elem` opts)
|
||||
(do
|
||||
putStrLn $ printf "Running %d tests%s:" n s
|
||||
sequence $ map (putStrLn . tname) $ tflatten flattests; putStrLn "Results:")
|
||||
runTestTT flattests
|
||||
where
|
||||
deeptests = tfilter matchname $ TestList tests
|
||||
|
||||
@ -62,7 +62,7 @@ main = do
|
||||
| cmd `isPrefixOf` "balance" = parseLedgerAndDo opts args balance
|
||||
| cmd `isPrefixOf` "print" = parseLedgerAndDo opts args print'
|
||||
| cmd `isPrefixOf` "register" = parseLedgerAndDo opts args register
|
||||
| cmd `isPrefixOf` "test" = runtests args >> return ()
|
||||
| cmd `isPrefixOf` "test" = runtests opts args >> return ()
|
||||
| otherwise = putStr usage
|
||||
|
||||
-- | parse the user's specified ledger file and do some action with it
|
||||
|
||||
Loading…
Reference in New Issue
Block a user