mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-10 14:16:41 +03:00
5c09553481
Related to #563, when rendering a transaction, we reserve two more chars of width so that amounts remain aligned when there are posting flags. Affects hledger-ui's transaction screen, print, hledger-rewrite etc.
139 lines
3.3 KiB
Plaintext
139 lines
3.3 KiB
Plaintext
# amount layout tests, using default vertical layout
|
|
# 1. print
|
|
hledger -f - print --explicit
|
|
<<<
|
|
2010/1/1
|
|
a EUR 1 ; a euro
|
|
b USD 1 ; a dollar
|
|
c ; a euro and a dollar
|
|
>>>
|
|
2010/01/01
|
|
a EUR 1 ; a euro
|
|
b USD 1 ; a dollar
|
|
c EUR -1 ; a euro and a dollar
|
|
c USD -1 ; a euro and a dollar
|
|
|
|
>>>=0
|
|
|
|
# 2. register
|
|
hledger -f - register
|
|
<<<
|
|
2010/1/1
|
|
a EUR 1 ; a euro
|
|
b USD 1 ; a dollar
|
|
c ; a euro and a dollar
|
|
>>>
|
|
2010/01/01 a EUR 1 EUR 1
|
|
b USD 1 EUR 1
|
|
USD 1
|
|
c EUR -1
|
|
USD -1 0
|
|
>>>=0
|
|
|
|
# 3. balance
|
|
hledger -f - balance
|
|
<<<
|
|
2010/1/1
|
|
a EUR 1 ; a euro
|
|
b USD 1 ; a dollar
|
|
c ; a euro and a dollar
|
|
>>>
|
|
EUR 1 a
|
|
USD 1 b
|
|
EUR -1
|
|
USD -1 c
|
|
--------------------
|
|
0
|
|
>>>=0
|
|
|
|
# 4. a single-commodity zero amount's commodity/decimal places/price is preserved, when possible
|
|
hledger -f- print --explicit --empty
|
|
<<<
|
|
2010/3/1 x
|
|
a $0.00 @ 3EUR
|
|
b
|
|
>>>
|
|
2010/03/01 x
|
|
a 0 @ 3EUR
|
|
b 0
|
|
|
|
>>>=0
|
|
|
|
# 5.
|
|
# When preserving a zero amount's commodity, we should also preserve
|
|
# the amount style, such as where to place the symbol.
|
|
# https://github.com/simonmichael/hledger/issues/230
|
|
hledger -f- balance
|
|
<<<
|
|
D 1000,00€
|
|
|
|
1/1
|
|
a:b 0
|
|
|
|
1/2
|
|
a:1 4000,58
|
|
a:D -1000,58
|
|
e -3000
|
|
>>>
|
|
3000,00€ a
|
|
4000,58€ 1
|
|
-1000,58€ D
|
|
-3000,00€ e
|
|
--------------------
|
|
0
|
|
>>>= 0
|
|
|
|
|
|
# 5. mixed amounts with prices
|
|
# XXX
|
|
# hledger -f - print
|
|
# <<<
|
|
# 2010/1/1
|
|
# a EUR 1 @ USD 1.1 ; a euro
|
|
# b USD 1 ; a dollar
|
|
# c ; a euro and a dollar
|
|
# >>>
|
|
# 2010/01/01
|
|
# a EUR 1 @ USD 1.1 ; a euro
|
|
# b USD 1 ; a dollar
|
|
# EUR -1 @ USD 1.1
|
|
# c USD -1 ; a euro and a dollar
|
|
#
|
|
##
|
|
# 2010/01/01
|
|
# a EUR 1 @ USD 1.1 ; a euro
|
|
# b USD 1.0 ; a dollar
|
|
# c USD -2.1 ; a euro and a dollar
|
|
#
|
|
#>>>=0
|
|
#
|
|
# #
|
|
# hledger -f - register
|
|
# <<<
|
|
# 2010/1/1
|
|
# a EUR 1 @ USD 1.1 ; a euro
|
|
# b USD 1 ; a dollar
|
|
# c ; a euro and a dollar
|
|
# >>>
|
|
# 2010/01/01 a EUR 1 EUR 1
|
|
# EUR 1
|
|
# b USD 1.0 USD 1.0
|
|
# EUR 1
|
|
# c USD -2.1 USD -1.1
|
|
#>>>=0
|
|
#
|
|
# #
|
|
# hledger -f - balance
|
|
# <<<
|
|
# 2010/1/1
|
|
# a EUR 1 @ USD 1.1 ; a euro
|
|
# b USD 1 ; a dollar
|
|
# c ; a euro and a dollar
|
|
# >>>
|
|
# EUR 1 a
|
|
# USD 1.0 b
|
|
# USD -2.1 c
|
|
# --------------------
|
|
# EUR 1
|
|
# USD -1.1
|