;bal: budget: add tests clarifying a surprising behaviour

This commit is contained in:
Simon Michael 2020-11-19 15:15:04 -08:00
parent 4a74680a22
commit 6948b05db6

View File

@ -556,3 +556,41 @@ $ hledger bal -f- --budget -TA not:income -O csv
"expenses:bills:c","","$50","","$50","","$50"
"expenses:bills:f","$10","0","$10","0","$10","0"
"Total:","$80","$370","$80","$370","$80","$370"
# 28. You might expect this to show a budget goal in jan, feb, mar.
# But by the usual report date logic, which picks the oldest and newest
# transaction date (1/15 and 3/15) as start and end date by default,
# and since "monthly" generates transactions on the 1st,
# the january budget goal transaction is excluded.
<
~ monthly in 2020
(expenses:food) $500
2020-01-15
expenses:food $400
assets:checking
2020-03-15
expenses:food $600
assets:checking
$ hledger -f- bal --budget -M
Budget performance in 2020Q1:
|| Jan Feb Mar
===============++=============================================
<unbudgeted> || $-400 0 $-600
expenses:food || $400 0 [0% of $500] $600 [120% of $500]
---------------++---------------------------------------------
|| 0 0 [0% of $500] 0 [ 0% of $500]
# 29. Specifying the report period works around it.
$ hledger -f- bal --budget -M date:2020q1
Budget performance in 2020Q1:
|| Jan Feb Mar
===============++===========================================================
<unbudgeted> || $-400 0 $-600
expenses:food || $400 [80% of $500] 0 [0% of $500] $600 [120% of $500]
---------------++-----------------------------------------------------------
|| 0 [ 0% of $500] 0 [0% of $500] 0 [ 0% of $500]