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

87 lines
1.6 KiB
Plaintext

# comment tests
# 1.
hledger -f - print
<<<
2009/01/01 x
; transaction comment 1
; transaction comment 2
a 1
b
>>>
2009/01/01 x
; transaction comment 1
; transaction comment 2
a 1
b
>>>=0
# 2.
hledger -f - print
<<<
2009/01/01 x
a 1
b
; comment line after postings
>>>
2009/01/01 x
a 1
b
>>>=0
# 3. print should preserve transaction (entry) comments and which line they're on
hledger -f - print
<<<
; leading journal comment, not preserved
; transaction preceding comment, not preserved
2009/1/1 x ; transaction same line comment
; transaction new line comment
a 1 ; posting 1 same line comment
; posting 1 new line comment
b
; posting 2 new line comment
; journal comment right after the transaction, not preserved
; trailing journal comment, not preserved
>>>
2009/01/01 x ; transaction same line comment
; transaction new line comment
a 1 ; posting 1 same line comment
; posting 1 new line comment
b
; posting 2 new line comment
>>>2
>>>=0
# 4. a posting comment should appear in print
hledger -f - print
<<<
2010/01/01 x
a 1 ; comment
b -1
>>>
2010/01/01 x
a 1 ; comment
b -1
>>>2
>>>=0
# 5. a posting comment should not appear in register
hledger -f - register
<<<
2010/1/1 x
a 1 ; comment
b
>>>
2010/01/01 x a 1 1
b -1 0
>>>2
>>>=0