hledger/tests/print/explicit.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

115 lines
1.6 KiB
Plaintext

# Tests of --explicit option effect
# 1. implicit transaction balance w/o --explict
hledger -f - print
<<<
2017/1/1
expenses $5
assets
>>>
2017/01/01
expenses $5
assets
>>>2
>>>=0
# 2. implicit transaction balance w/ --explict
hledger -f - print --explicit
<<<
2017/1/1
expenses $5
assets
>>>
2017/01/01
expenses $5
assets $-5
>>>2
>>>=0
# 3. implicit commodity price w/o --explict
hledger -f - print
<<<
2017/1/1
expenses 4 EUR
assets $-5
>>>
2017/01/01
expenses 4 EUR
assets $-5
>>>2
>>>=0
# 4. implicit commodity price w/ --explict
hledger -f - print --explicit
<<<
2017/1/1
expenses 4 EUR
assets $-5
>>>
2017/01/01
expenses 4 EUR @@ $5
assets $-5
>>>2
>>>=0
# 5. implicit account balance w/o --explict
hledger -f - print
<<<
2017/1/1
assets = $100
equity
>>>
2017/01/01
assets = $100
equity
>>>2
>>>=0
# 6. implicit account balance w/ --explict
hledger -f - print --explicit
<<<
2017/1/1
assets = $100
equity
>>>
2017/01/01
assets $100 = $100
equity $-100
>>>2
>>>=0
# 7. default commodity always applied because print do not issue appropriate directive
hledger -f - print
<<<
D 1000.00 EUR
2017/1/1
expenses 100
assets
>>>
2017/01/01
expenses 100.00 EUR
assets
>>>2
>>>=0
# 8. option --explicit implies effect of --empty
hledger -f - print --explicit
<<<
2017/1/1
assets $0
equity
>>>
2017/01/01
assets 0
equity 0
>>>2
>>>=0