hook up more tests, begin converting remaining reports to Query

This commit is contained in:
Simon Michael 2012-05-17 04:21:34 +00:00
parent 2feb36e57f
commit 1e2c2bb10c
3 changed files with 27 additions and 3 deletions

View File

@ -3,9 +3,20 @@ module Hledger (
,module Hledger.Read ,module Hledger.Read
,module Hledger.Reports ,module Hledger.Reports
,module Hledger.Utils ,module Hledger.Utils
,tests_Hledger
) )
where where
import Test.HUnit
import Hledger.Data import Hledger.Data
import Hledger.Read import Hledger.Read
import Hledger.Reports import Hledger.Reports
import Hledger.Utils import Hledger.Utils
tests_Hledger = TestList
[
tests_Hledger_Data
,tests_Hledger_Data_Query
,tests_Hledger_Read
,tests_Hledger_Reports
]

View File

@ -232,6 +232,19 @@ entriesReport opts fspec j = sortBy (comparing f) $ jtxns $ filterJournalTransac
f = transactionDateFn opts f = transactionDateFn opts
j' = journalSelectingAmountFromOpts opts j j' = journalSelectingAmountFromOpts opts j
-- | Select transactions for an entries report.
entriesReport2 :: ReportOpts -> Query -> Journal -> EntriesReport
entriesReport2 opts q j =
sortBy (comparing f) $ filter (not . null . tpostings) $ map (filterTransactionPostings q) $ jtxns j'
where
f = transactionDateFn opts
j' = journalSelectingAmountFromOpts opts j
tests_entriesReport2 = [
"entriesReport2" ~: do
assertEqual "" [] (entriesReport2 defreportopts Any nulljournal)
]
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- | A postings report is a list of postings with a running total, a label -- | A postings report is a list of postings with a running total, a label
@ -594,7 +607,8 @@ isInterestingIndented opts l a
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
tests_Hledger_Reports :: Test tests_Hledger_Reports :: Test
tests_Hledger_Reports = TestList tests_Hledger_Reports = TestList $
tests_entriesReport2 ++
[ [
"summarisePostingsByInterval" ~: do "summarisePostingsByInterval" ~: do

View File

@ -42,8 +42,7 @@ import Hledger.Cli.Version
tests_Hledger_Cli :: Test tests_Hledger_Cli :: Test
tests_Hledger_Cli = TestList tests_Hledger_Cli = TestList
[ [
tests_Hledger_Data tests_Hledger
,tests_Hledger_Read
-- ,tests_Hledger_Cli_Add -- ,tests_Hledger_Cli_Add
-- ,tests_Hledger_Cli_Balance -- ,tests_Hledger_Cli_Balance
,tests_Hledger_Cli_Balancesheet ,tests_Hledger_Cli_Balancesheet