tests: upgrade, document print --auto tests

This commit is contained in:
Simon Michael 2018-10-22 11:09:53 -07:00
parent 080e475eb9
commit bcd15137c6

View File

@ -1,6 +1,9 @@
# Add proportional income tax (from documentation) # Transaction modifier adding (unbalanced) tax postings.
hledger print -f- --auto # print. Auto-generated postings are inserted below the matched one.
<<< <
= ^income
(liabilities:tax) *.33 ; income tax
2016/1/1 paycheck 2016/1/1 paycheck
income:remuneration $-100 income:remuneration $-100
income:donations $-15 income:donations $-15
@ -10,9 +13,7 @@ hledger print -f- --auto
assets:cash $20 assets:cash $20
assets:bank assets:bank
= ^income $ hledger print -f- --auto
(liabilities:tax) *.33 ; income tax
>>>
2016/01/01 paycheck 2016/01/01 paycheck
income:remuneration $-100 income:remuneration $-100
(liabilities:tax) $-33 ; income tax (liabilities:tax) $-33 ; income tax
@ -24,23 +25,10 @@ hledger print -f- --auto
assets:cash $20 assets:cash $20
assets:bank assets:bank
>>>2 >=
>>>=0
hledger register -f- --auto # register
<<< $ hledger register -f- --auto
2016/1/1 paycheck
income:remuneration $-100
income:donations $-15
assets:bank
2016/1/1 withdraw
assets:cash $20
assets:bank
= ^income
(liabilities:tax) *.33 ; income tax
>>>
2016/01/01 paycheck income:remuneration $-100 $-100 2016/01/01 paycheck income:remuneration $-100 $-100
(liabilities:tax) $-33 $-133 (liabilities:tax) $-33 $-133
income:donations $-15 $-148 income:donations $-15 $-148
@ -48,38 +36,10 @@ hledger register -f- --auto
assets:bank $115 $-38 assets:bank $115 $-38
2016/01/01 withdraw assets:cash $20 $-18 2016/01/01 withdraw assets:cash $20 $-18
assets:bank $-20 $-38 assets:bank $-20 $-38
>>>2 >=
>>>=0
hledger register -f- --auto # balance
<<< $ hledger balance -f- --auto
= trigger
(target) 10
2018/1/1
(trigger) 1
(target) 1 = 11 ; this assertion would not fail, auto posting will be taken into account
>>>
2018/01/01 (trigger) 1 1
(target) 10 11
(target) 1 12
>>>2
>>>=0
hledger balance -f- --auto
<<<
2016/1/1 paycheck
income:remuneration $-100
income:donations $-15
assets:bank
2016/1/1 withdraw
assets:cash $20
assets:bank
= ^income
(liabilities:tax) *.33 ; income tax
>>>
$115 assets $115 assets
$95 bank $95 bank
$20 cash $20 cash
@ -89,11 +49,25 @@ hledger balance -f- --auto
$-38 liabilities:tax $-38 liabilities:tax
-------------------- --------------------
$-38 $-38
>>>2 >=
>>>=0
hledger print -f- --auto # 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 = ^expenses:groceries
[budget:groceries] *-1 [budget:groceries] *-1
[assets:bank:checking] *1 [assets:bank:checking] *1
@ -101,12 +75,12 @@ hledger print -f- --auto
2018/10/7 * MARKET 2018/10/7 * MARKET
expenses:groceries:food expenses:groceries:food
assets:bank:checking $-20 assets:bank:checking $-20
>>>
$ hledger print -f- --auto
2018/10/07 * MARKET 2018/10/07 * MARKET
expenses:groceries:food expenses:groceries:food
[budget:groceries] $-20 [budget:groceries] $-20
[assets:bank:checking] $20 [assets:bank:checking] $20
assets:bank:checking $-20 assets:bank:checking $-20
>>>2 >=
>>>=0