diff --git a/Ledger.hs b/Ledger.hs index d5b4822f7..65f369044 100644 --- a/Ledger.hs +++ b/Ledger.hs @@ -1,5 +1,7 @@ module Ledger where +import qualified Data.Map as Map + import Utils import AccountName import BasicTypes @@ -32,6 +34,9 @@ ledgerTransactionsMatching (acctregexps,descregexps) l = (concat [filter (matchTransactionDescription r) ts | r <- descregexps]) where ts = ledgerTransactions l +ledgerTransactionsInAccount :: Ledger -> AccountName -> [EntryTransaction] +ledgerTransactionsInAccount l a = ledgerTransactionsMatching (["^" ++ a ++ "$"], []) l + accountNamesFromTransactions :: [EntryTransaction] -> [AccountName] accountNamesFromTransactions ts = nub $ map account ts diff --git a/Tests.hs b/Tests.hs index 2f9533ad7..c1223a750 100644 --- a/Tests.hs +++ b/Tests.hs @@ -1,6 +1,7 @@ module Tests where +import qualified Data.Map as Map import Text.ParserCombinators.Parsec import Test.QuickCheck import Test.HUnit @@ -219,6 +220,7 @@ ledger7 = Ledger } ] + -- utils assertEqual' e a = assertEqual "" e a