2011-09-23 00:40:06 +04:00
|
|
|
#!/usr/bin/env shelltest
|
2011-04-20 01:32:13 +04:00
|
|
|
# 1. One commodity. Zero accounts should be elided but the final total should not.
|
2012-10-21 22:23:23 +04:00
|
|
|
hledgerdev -f - balance
|
2011-04-20 00:22:14 +04:00
|
|
|
<<<
|
|
|
|
2010/04/01 tr1
|
|
|
|
a 16$
|
|
|
|
b -16$
|
|
|
|
|
|
|
|
2010/04/02 tr2
|
|
|
|
a -16$
|
|
|
|
b 16$
|
|
|
|
>>>
|
|
|
|
--------------------
|
|
|
|
0
|
2011-04-20 01:32:13 +04:00
|
|
|
>>>=0
|
2011-09-23 00:40:06 +04:00
|
|
|
|
|
|
|
# 2. An uninteresting parent account (with same balance as its single subaccount) is elided by default, like ledger
|
2012-10-21 22:23:23 +04:00
|
|
|
hledgerdev -f - balance --no-total
|
2011-09-23 00:40:06 +04:00
|
|
|
<<<
|
|
|
|
1/1
|
|
|
|
(a:b) 1
|
|
|
|
>>>
|
|
|
|
1 a:b
|
|
|
|
>>>=0
|
|
|
|
|
|
|
|
# 3. But not with --no-elide
|
2012-10-21 22:23:23 +04:00
|
|
|
hledgerdev -f - balance --no-total --no-elide
|
2011-09-23 00:40:06 +04:00
|
|
|
<<<
|
|
|
|
1/1
|
|
|
|
(a:b) 1
|
|
|
|
>>>
|
|
|
|
1 a
|
|
|
|
1 b
|
|
|
|
>>>=0
|
|
|
|
|
|
|
|
# 4. Nor when it has more than one subaccount
|
2012-10-21 22:23:23 +04:00
|
|
|
hledgerdev -f - balance --no-total
|
2011-09-23 00:40:06 +04:00
|
|
|
<<<
|
|
|
|
1/1
|
|
|
|
(a:b) 1
|
|
|
|
(a:c) -1
|
|
|
|
>>>
|
|
|
|
0 a
|
|
|
|
1 b
|
|
|
|
-1 c
|
|
|
|
>>>2
|
|
|
|
>>>=0
|
|
|
|
|