hledger/tests/journal/commodities.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

50 lines
912 B
Plaintext

# a commodity may contain/end with numbers, if double quoted
# 1. without quotes, fail. XXX parse error should be clearer here
hledger -f- print
<<<
2010-04-05 x
a 10 DE0002635307
b
>>>2 /unexpected/
>>>= 1
# 2. with quotes, ok; quotes appear in print output
hledger -f- print --explicit
<<<
2010-04-05 x
a 10 "DE 0002 635307"
b
>>>
2010/04/05 x
a 10 "DE 0002 635307"
b -10 "DE 0002 635307"
>>>=0
# 3. and in other reports too, I guess
hledger -f- balance
<<<
2010-04-05 x
a 10 "DE0002635307"
b
>>>
10 "DE0002635307" a
-10 "DE0002635307" b
--------------------
0
>>>=0
# 4. autobalance with prices
hledger -f- print --explicit
<<<
2016/1/1
saving-card $-105
snacks 95 EUR @@ $100
Equity:Unbalanced
>>>
2016/01/01
saving-card $-105
snacks 95 EUR @@ $100
Equity:Unbalanced $5
>>>=0