hledger/tests/bin/rewrite.test
2017-01-08 07:28:23 -08:00

76 lines
1.7 KiB
Plaintext

# Tests for rewrite addon
# Add proportional income tax (from documentation)
runghc ../../bin/hledger-rewrite.hs -f- ^income --add-posting '(liabilities:tax) *.33'
<<<
2016/1/1 paycheck
income:remuneration $-100
assets:bank
2016/1/1 withdraw
assets:cash $20
assets:bank
>>>
2016/01/01 paycheck
income:remuneration $-100
assets:bank $100
(liabilities:tax) $-33
2016/01/01 withdraw
assets:cash $20
assets:bank $-20
>>>=0
# Duplicate posting for budgeting (from documentation)
runghc ../../bin/hledger-rewrite.hs -f- expenses:gifts --add-posting '(budget:gifts) *-1'
<<<
2016/1/1 withdraw
assets:cash $20
assets:bank
2016/1/1 gift
assets:cash $-15
expenses:gifts
>>>
2016/01/01 withdraw
assets:cash $20
assets:bank $-20
2016/01/01 gift
assets:cash $-15
expenses:gifts $15
(budget:gifts) $-15
>>>=0
# Add absolute bank processing fee
runghc ../../bin/hledger-rewrite.hs -f- assets:bank and 'amt:<0' --add-posting 'expenses:fee $5' --add-posting 'assets:bank $-5'
<<<
2016/1/1 withdraw
assets:cash $20
assets:bank
2016/1/2 withdraw
assets:cash
assets:bank $-30
# # TODO: Fix to filter out this txn by missing amt:<0 condition on assets:bank
# 2016/1/31 paycheck
# income:remuneration $-100
# assets:bank
>>>
2016/01/01 withdraw
assets:cash $20
assets:bank $-20
expenses:fee $5
assets:bank $-5
2016/01/02 withdraw
assets:cash $30
assets:bank $-30
expenses:fee $5
assets:bank $-5
>>>=0