test: balance: Add tests for --layout options.

This commit is contained in:
Stephen Morgan 2021-11-13 10:20:33 +11:00 committed by Simon Michael
parent de2776c996
commit 8f1ae08f0a

View File

@ -1,21 +1,60 @@
# 1. In tabular balance reports, display on a single line by default
< <
2020-01-01 2020-01-01
(a) 1.00A (a) 1.00A
(a) 1.00B (a) 1.00B
(a) 1.00C (a) 1.00C
(a) 1.00D (a) 1.00D
2021-01-01
(a) 1.00D
(a) 1.00E (a) 1.00E
(a) 1.00F (a) 1.00F
$ hledger -f- bal -Y --no-elide # 1. In tabular balance reports, display on a single line by default
Balance changes in 2020: $ hledger -f- bal -Y
Balance changes in 2020-01-01..2021-12-31:
|| 2020 || 2020 2021
===++========================================== ===++=================================================
a || 1.00A, 1.00B, 1.00C, 1.00D, 1.00E, 1.00F a || 1.00A, 1.00B, 1.00C, 1.00D 1.00D, 1.00E, 1.00F
---++------------------------------------------ ---++-------------------------------------------------
|| 1.00A, 1.00B, 1.00C, 1.00D, 1.00E, 1.00F || 1.00A, 1.00B, 1.00C, 1.00D 1.00D, 1.00E, 1.00F
# 2. Display multiline if requested
$ hledger -f- bal -Y --commodity-layout=multiline
Balance changes in 2020-01-01..2021-12-31:
|| 2020 2021
===++==============
a || 1.00A 1.00D
a || 1.00B 1.00E
a || 1.00C 1.00F
a || 1.00D
---++--------------
|| 1.00A 1.00D
|| 1.00B 1.00E
|| 1.00C 1.00F
|| 1.00D
# 3. Display a commodity column if requested
$ hledger -f- bal -Y --commodity-layout=column
Balance changes in 2020-01-01..2021-12-31:
|| Commodity 2020 2021
===++=======================
a || A 1.00 0
a || B 1.00 0
a || C 1.00 0
a || D 1.00 1.00
a || E 0 1.00
a || F 0 1.00
---++-----------------------
|| A 1.00 0
|| B 1.00 0
|| C 1.00 0
|| D 1.00 1.00
|| E 0 1.00
|| F 0 1.00
< <
2020-02-22 2020-02-22
@ -38,7 +77,7 @@ Balance changes in 2020:
ea50865f:3bfb86b7:bf72f75a:a7cad1ac C$ -26.00 ea50865f:3bfb86b7:bf72f75a:a7cad1ac C$ -26.00
ea50865f:325566ed:216fec7e:7b433efb C$ 1.44 ea50865f:325566ed:216fec7e:7b433efb C$ 1.44
# 2. Make sure all amounts up to the largest fit # 4. Make sure all amounts up to the largest fit
$ hledger -f- bal -Y --color=yes $ hledger -f- bal -Y --color=yes
Balance changes in 2020: Balance changes in 2020: