another balance report test, another step closer
This commit is contained in:
parent
a64d320c84
commit
b9b9ce7d51
@ -93,9 +93,10 @@ Some notes for the implementation:
|
||||
- zero-balance leaf accounts are removed
|
||||
|
||||
- the resulting account tree is displayed with each account's aggregated
|
||||
balance, with boring parents prefixed to the next line. A boring parent
|
||||
has the same balance as its single child and is not explicitly matched
|
||||
by the display options.
|
||||
balance, with boring parents prefixed to the next line
|
||||
|
||||
- a boring parent has the same balance as its child and is not explicitly
|
||||
matched by the display options.
|
||||
|
||||
- the sum of the balances shown is displayed at the end, if it is non-zero
|
||||
|
||||
@ -177,7 +178,7 @@ showAccountTreeWithBalances matchedacctnames =
|
||||
showbal = printf "%20s" $ show bal
|
||||
indent = replicate (indentlevel * 2) ' '
|
||||
leafname = accountLeafName fullname
|
||||
isboringparent = numsubs == 1 && (bal == subbal || not matched)
|
||||
numsubs = length subs
|
||||
subbal = abalance $ root $ head subs
|
||||
matched = fullname `elem` matchedacctnames
|
||||
isboringparent = numsubs >= 1 && (bal == subbal || not matched)
|
||||
|
||||
12
Tests.hs
12
Tests.hs
@ -182,6 +182,18 @@ balancecommandtests =
|
||||
\ $1 liabilities:debts\n\
|
||||
\" --"
|
||||
(balancereport [] ["e"] l)
|
||||
,
|
||||
|
||||
"balance report with unmatched parent of two matched subaccounts" ~: do
|
||||
rl <- rawledgerfromfile "sample.ledger"
|
||||
let l = cacheLedger (regexFor ["cash","saving"]) $ filterRawLedgerEntries "" "" wildcard rl
|
||||
assertequal
|
||||
" $-2 assets:cash\n\
|
||||
\ $1 assets:saving\n\
|
||||
\--------------------\n\
|
||||
\ $-1\n\
|
||||
\" --"
|
||||
(balancereport [] ["cash","saving"] l)
|
||||
]
|
||||
|
||||
-- | Assert a parsed thing equals some expected thing, or print a parse error.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user