hledger/tests/print/auto.test
2018-10-22 11:09:53 -07:00

87 lines
2.5 KiB
Plaintext

# Transaction modifier adding (unbalanced) tax postings.
# print. Auto-generated postings are inserted below the matched one.
<
= ^income
(liabilities:tax) *.33 ; income tax
2016/1/1 paycheck
income:remuneration $-100
income:donations $-15
assets:bank
2016/1/1 withdraw
assets:cash $20
assets:bank
$ hledger print -f- --auto
2016/01/01 paycheck
income:remuneration $-100
(liabilities:tax) $-33 ; income tax
income:donations $-15
(liabilities:tax) $-5 ; income tax
assets:bank
2016/01/01 withdraw
assets:cash $20
assets:bank
>=
# register
$ hledger register -f- --auto
2016/01/01 paycheck income:remuneration $-100 $-100
(liabilities:tax) $-33 $-133
income:donations $-15 $-148
(liabilities:tax) $-5 $-153
assets:bank $115 $-38
2016/01/01 withdraw assets:cash $20 $-18
assets:bank $-20 $-38
>=
# balance
$ hledger balance -f- --auto
$115 assets
$95 bank
$20 cash
$-115 income
$-15 donations
$-100 remuneration
$-38 liabilities:tax
--------------------
$-38
>=
# Balance assertions see the generated postings.
<
= trigger
(target) 10
2018/1/1
(trigger) 1
(target) 1 = 11 ; this assertion would not fail, auto posting will be taken into account
$ hledger register -f- --auto
2018/01/01 (trigger) 1 1
(target) 10 11
(target) 1 12
>=
# Transaction modifier adding (balanced virtual) budget envelope postings.
<
= ^expenses:groceries
[budget:groceries] *-1
[assets:bank:checking] *1
2018/10/7 * MARKET
expenses:groceries:food
assets:bank:checking $-20
$ hledger print -f- --auto
2018/10/07 * MARKET
expenses:groceries:food
[budget:groceries] $-20
[assets:bank:checking] $20
assets:bank:checking $-20
>=