test and fix for register --depth
This commit is contained in:
parent
1fc9d47bd8
commit
7ba0dc06a5
1
NOTES
1
NOTES
@ -10,7 +10,6 @@ clever tricks like the plague." --Edsger Dijkstra
|
|||||||
|
|
||||||
* to do
|
* to do
|
||||||
** errors
|
** errors
|
||||||
*** --depth works with reg -W but not with reg
|
|
||||||
*** register report should sort by date
|
*** register report should sort by date
|
||||||
** features
|
** features
|
||||||
*** more ledger features
|
*** more ledger features
|
||||||
|
|||||||
@ -33,7 +33,8 @@ showRegisterReport opts args l
|
|||||||
| otherwise = showtxns summaryts nulltxn startbal
|
| otherwise = showtxns summaryts nulltxn startbal
|
||||||
where
|
where
|
||||||
interval = intervalFromOpts opts
|
interval = intervalFromOpts opts
|
||||||
ts = filterempties $ filter matchapats $ ledgerTransactions l
|
ts = filterempties $ filter matchapats $ filterdepth $ ledgerTransactions l
|
||||||
|
filterdepth = filter (\t -> (accountNameLevel $ account t) <= depth)
|
||||||
filterempties
|
filterempties
|
||||||
| Empty `elem` opts = id
|
| Empty `elem` opts = id
|
||||||
| otherwise = filter (not . isZeroMixedAmount . amount)
|
| otherwise = filter (not . isZeroMixedAmount . amount)
|
||||||
|
|||||||
13
Tests.hs
13
Tests.hs
@ -476,6 +476,19 @@ tests = [
|
|||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
, "register report with depth arg" ~:
|
||||||
|
do
|
||||||
|
l <- sampleledger
|
||||||
|
showRegisterReport [Depth "2"] [] l `is` unlines
|
||||||
|
["2008/01/01 income income:salary $-1 $-1"
|
||||||
|
,"2008/06/01 gift income:gifts $-1 $-2"
|
||||||
|
,"2008/06/03 eat & shop expenses:food $1 $-1"
|
||||||
|
," expenses:supplies $1 0"
|
||||||
|
," assets:cash $-2 $-2"
|
||||||
|
,"2008/12/31 pay off liabilities:debts $1 $-1"
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
,"show dollars" ~: show (dollars 1) ~?= "$1.00"
|
,"show dollars" ~: show (dollars 1) ~?= "$1.00"
|
||||||
|
|
||||||
,"show hours" ~: show (hours 1) ~?= "1.0h"
|
,"show hours" ~: show (hours 1) ~?= "1.0h"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user