hledger/tests/misc/amount-rendering.test
Simon Michael cc98ee39f7 balance, lib: --format/StringFormat improvements
The balance command's --format option (in single-column mode) can now
adjust the rendering of multi-line strings, such as amounts with multiple
commodities. To control this, begin the format string with one of:

 %_  - renders on multiple lines, bottom-aligned (the default)
 %^  - renders on multiple lines, top-aligned
 %,  - render on one line, comma-separated

Also the final total (and the line above it) now adapt themselves to a
custom format.
2015-08-19 20:53:51 -07:00

115 lines
2.8 KiB
Plaintext

# amount layout tests, using default vertical layout
# 1. print
hledger -f - print
<<<
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
EUR -1
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 zero amount is always displayed as just "0", regardless of any commodity/decimal places/price (like ledger)
#
hledger -f- print --empty
<<<
2010/3/1 x
a $0.00 @ 3EUR
b
>>>
2010/03/01 x
a 0
b 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