mirror of
https://github.com/simonmichael/hledger.git
synced 2025-01-06 02:23:46 +03:00
subAccounts test and bugfix
This commit is contained in:
parent
c1267ff17c
commit
2dac5754c7
@ -111,7 +111,7 @@ accountsMatching pats l = filter (matchpats pats . aname) $ accounts l
|
||||
-- | List a ledger account's immediate subaccounts
|
||||
subAccounts :: Ledger -> Account -> [Account]
|
||||
subAccounts l Account{aname=a} =
|
||||
map (ledgerAccount l) $ filter (a `isAccountNamePrefixOf`) $ accountnames l
|
||||
map (ledgerAccount l) $ filter (`isSubAccountNameOf` a) $ accountnames l
|
||||
|
||||
-- | List a ledger's transactions.
|
||||
ledgerTransactions :: Ledger -> [Transaction]
|
||||
|
6
Tests.hs
6
Tests.hs
@ -536,6 +536,12 @@ tests = [
|
||||
[mkdatespan "2008/01/01" "2008/01/01"]
|
||||
,
|
||||
|
||||
"subAccounts" ~: do
|
||||
l <- sampleledger
|
||||
let a = ledgerAccount l "assets"
|
||||
(map aname $ subAccounts l a) `is` ["assets:bank","assets:cash"]
|
||||
,
|
||||
|
||||
"summariseTransactionsInDateSpan" ~: do
|
||||
let (b,e,entryno,depth,showempty,ts) `gives` summaryts =
|
||||
summariseTransactionsInDateSpan (mkdatespan b e) entryno depth showempty ts `is` summaryts
|
||||
|
Loading…
Reference in New Issue
Block a user