mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-29 05:11:33 +03:00
21d9945ba9
Using "hledgerdev" was a hack to help ensure that tests used a fresh developer build by default. Now they specify "hledger" again, which fits better with stack. It's up to the tester to make sure the desired executable is first in PATH or specified with -w. (Note a couple of tests currently don't obey -w and will always run "hledger", see addons.test).
61 lines
1.0 KiB
Plaintext
61 lines
1.0 KiB
Plaintext
#!/usr/bin/env shelltest
|
|
# 1. One commodity. Zero accounts should be elided but the final total should not.
|
|
hledger -f - balance
|
|
<<<
|
|
2010/04/01 tr1
|
|
a 16$
|
|
b -16$
|
|
|
|
2010/04/02 tr2
|
|
a -16$
|
|
b 16$
|
|
>>>
|
|
--------------------
|
|
0
|
|
>>>=0
|
|
|
|
# 2. An uninteresting parent account (with same balance as its single subaccount) is elided by default, like ledger
|
|
hledger -f - balance --no-total
|
|
<<<
|
|
1/1
|
|
(a:b) 1
|
|
>>>
|
|
1 a:b
|
|
>>>=0
|
|
|
|
# 3. But not with --no-elide
|
|
hledger -f - balance --no-total --no-elide
|
|
<<<
|
|
1/1
|
|
(a:b) 1
|
|
>>>
|
|
1 a
|
|
1 b
|
|
>>>=0
|
|
|
|
# 4. Nor when it has more than one subaccount
|
|
hledger -f - balance --no-total
|
|
<<<
|
|
1/1
|
|
(a:b) 1
|
|
(a:c) -1
|
|
>>>
|
|
0 a
|
|
1 b
|
|
-1 c
|
|
>>>2
|
|
>>>=0
|
|
|
|
# 5. Zero-balance leaves should also be hidden by default.
|
|
hledger -f - balance --no-total
|
|
<<<
|
|
1/1
|
|
(a) 1
|
|
(a:aa) 1
|
|
(a:aa) -1
|
|
(a:aa:aaa) 1
|
|
(a:aa:aaa) -1
|
|
>>>
|
|
1 a
|
|
>>>=0
|