hledger/tests/journal/directives-account.test
2018-10-10 20:31:08 -07:00

75 lines
1.7 KiB
Plaintext

# account names
# 1. "apply account" and "alias" affect "account" directives.
<
apply account c
alias c:a=b
account a
$ hledger -f - accounts
b
# 2. account directives can declare account type.
# Here "asset" is a liability, despite the name. So are its subaccounts.
# "b" is a liability. "b:bb" is an asset.
<
; a liability
account asset L
; an asset
account b:bb A
; a liability
account b L
2018/1/1
(asset:a) 1
(b) 2
(b:bb) 3
$ hledger -f - bs -N --flat
Balance Sheet 2018/01/01
|| 2018/01/01
=============++============
Assets ||
-------------++------------
b:bb || 3
-------------++------------
|| 3
=============++============
Liabilities ||
-------------++------------
asset:a || -1
b || -2
-------------++------------
|| -3
# 3. Tree mode. A little weird, b appears twice.
# It must be shown above bb, but since not an asset, its balance is excluded there.
# It is shown again in the liabilities section, this time with balance.
$ hledger -f - bs -N
Balance Sheet 2018/01/01
|| 2018/01/01
=============++============
Assets ||
-------------++------------
b || 3
bb || 3
-------------++------------
|| 3
=============++============
Liabilities ||
-------------++------------
asset || -1
a || -1
b || -2
-------------++------------
|| -3
# TODO
# a trailing : should give a clear error
# 2009/1/1
# a: 1
# $ hledger -f - print
# >2 /accountname seems ill-formed: a:/
# >= 1