hledger/tests/bin/rewrite.test
Mykola Orliuk 015b764d00 Preserve implicit amounts and prices the way user wrote them in output of print command (#471)
* Remember original postings during infer and pivot

This includes such functions like:
- inferFromAssignment
- inferBalancingAmount
- inferBalancingPrices
- pivotPosting

* Use original postings for hledger print

- Introduce "--explicit" option for "print" command which brings back
  old behavior when every inferred number being printed.
- Make "print" by default print original postings without inferred
  amounts. But use effective account name to have effect from aliases.
- Instruct shell tests with an new expected output or to use
  --explicit option when inferred amounts are checked.

Resolves simonmichael/hledger#442
2017-01-13 07:25:44 -08:00

79 lines
1.6 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
(liabilities:tax) $-33
2016/01/01 withdraw
assets:cash $20
assets:bank
>>>2
>>>=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
2016/01/01 gift
assets:cash $-15
expenses:gifts
(budget:gifts) $-15
>>>2
>>>=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
expenses:fee $5
assets:bank $-5
2016/01/02 withdraw
assets:cash
assets:bank $-30
expenses:fee $5
assets:bank $-5
>>>2
>>>=0