;check: add tests for all on-demand checks

This commit is contained in:
Simon Michael 2020-12-31 10:27:50 -08:00
parent 2084b845e0
commit a6ec7bcc11
5 changed files with 62 additions and 3 deletions

View File

@ -0,0 +1,14 @@
# check accounts succeeds when all accounts are declared
<
account a
2020-01-01
(a) 1
$ hledger -f- check accounts
# and otherwise fails:
<
2020-01-01
(a) 1
$ hledger -f- check accounts
>2 /undeclared account "a"/
>=1

View File

@ -0,0 +1,14 @@
# check commodities succeeds when all commodities are declared
<
commodity $1.
2020-01-01
(a) $1
$ hledger -f- check commodities
# and otherwise fails
<
2020-01-01
(a) $1
$ hledger -f- check commodities
>2 /undeclared commodity "\$"/
>=1

View File

@ -0,0 +1,17 @@
# check ordereddates succeeds when transaction dates are ordered
<
2020-01-01
2020-01-01
2020-01-02
$ hledger -f- check ordereddates
# and otherwise fails
<
2020-01-01
2020-01-02
2020-01-01
(a) 1
$ hledger -f- check ordereddates
> /transaction date is out of order/
>=1
# XXX make it >2

View File

@ -1,5 +1,3 @@
# check payees
# check payees succeeds when all payees are declared:
<
payee foo
@ -7,7 +5,7 @@ payee foo
2020-01-02 foo | some description
$ hledger -f - check payees
# and otherwise fails, eg:
# and otherwise fails:
<
2020-01-01 foo
$ hledger -f - check payees

View File

@ -0,0 +1,16 @@
# check uniqueleafnames succeeds when all account leaf names are unique
<
2020-01-01
(a) 1
(a:aa) 1
$ hledger -f- check uniqueleafnames
# and otherwise fails
<
2020-01-01
(a) 1
(b:a) 1
$ hledger -f- check uniqueleafnames
> /a as a, b:a/
>=1
# XXX make it >2; improve message