From f0914ff08eceadcb67a291222d24209e351ffb44 Mon Sep 17 00:00:00 2001 From: Nicholas Niro Date: Mon, 10 Jul 2017 12:47:51 -0400 Subject: [PATCH] lib: Added a new much more thorough test to MultiBalanceReports. This test makes sure that -H works correctly and it does not show empty accounts. --- hledger-lib/Hledger/Reports/MultiBalanceReports.hs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/hledger-lib/Hledger/Reports/MultiBalanceReports.hs b/hledger-lib/Hledger/Reports/MultiBalanceReports.hs index 4d503558a..6203e64b7 100644 --- a/hledger-lib/Hledger/Reports/MultiBalanceReports.hs +++ b/hledger-lib/Hledger/Reports/MultiBalanceReports.hs @@ -241,6 +241,20 @@ tests_multiBalanceReport = ,("income:salary","salary",2, [mamountp' "$-1.00"], mamountp' "$-1.00",Mixed [amount0 {aquantity=(-1)}]) ], Mixed [usd0]) + + ,"multiBalanceReport tests the ability to have a valid history on an empty period (More complex)" ~: do + (defreportopts{period_= PeriodBetween (fromGregorian 2009 1 1) (fromGregorian 2009 1 2), balancetype_=HistoricalBalance}, samplejournal) `gives` + ( + [ + ("assets:bank:checking","checking",3, [mamountp' "$1.00"], mamountp' "$1.00",Mixed [amount0 {aquantity=1}]) + ,("assets:bank:saving","saving",3, [mamountp' "$1.00"], mamountp' "$1.00",Mixed [amount0 {aquantity=1}]) + ,("assets:cash","cash",2, [mamountp' "$-2.00"], mamountp' "$-2.00",Mixed [amount0 {aquantity=(-2)}]) + ,("expenses:food","food",2, [mamountp' "$1.00"], mamountp' "$1.00",Mixed [amount0 {aquantity=(1)}]) + ,("expenses:supplies","supplies",2, [mamountp' "$1.00"], mamountp' "$1.00",Mixed [amount0 {aquantity=(1)}]) + ,("income:gifts","gifts",2, [mamountp' "$-1.00"], mamountp' "$-1.00",Mixed [amount0 {aquantity=(-1)}]) + ,("income:salary","salary",2, [mamountp' "$-1.00"], mamountp' "$-1.00",Mixed [amount0 {aquantity=(-1)}]) + ], + Mixed [usd0]) ] tests_Hledger_Reports_MultiBalanceReport :: Test