test: errors: make tests runnable

This commit is contained in:
Simon Michael 2022-03-18 06:59:33 -10:00
parent 3775b97f04
commit 2b2d643333
12 changed files with 15 additions and 11 deletions

View File

@ -392,7 +392,7 @@ journalCheckAccountsDeclared j = mapM_ checkacct (journalPostings j)
++ case ptransaction of
Nothing -> ""
Just t -> printf "in transaction at: %s\n\n%s"
(sourcePosPairPretty $ tsourcepos t)
(sourcePosPairPrettxy $ tsourcepos t)
(linesPrepend " " . (<>"\n") . textChomp $ showTransaction t)
where
as = journalAccountNamesDeclared j

2
hledger/test/errors/failing-balance-assertion.j Normal file → Executable file
View File

@ -1,4 +1,4 @@
# hledger check
#!/usr/bin/env -S hledger check -f
1/1
a 0 = 1

2
hledger/test/errors/invalid-date.j Normal file → Executable file
View File

@ -1,4 +1,4 @@
# hledger check
#!/usr/bin/env -S hledger check -f
2022/1/32
(a:c) 1

2
hledger/test/errors/invalid-regex.j Normal file → Executable file
View File

@ -1,3 +1,3 @@
# hledger check
#!/usr/bin/env -S hledger check -f
alias /(/ = a

2
hledger/test/errors/nonunique-leaf-names.j Normal file → Executable file
View File

@ -1,4 +1,4 @@
# hledger check uniqueleafnames
#!/usr/bin/env -S hledger check uniqueleafnames -f
account a:c ; XXX check uniqueleafnames doesn't notice these
account b:c ;

2
hledger/test/errors/parse-error.j Normal file → Executable file
View File

@ -1,3 +1,3 @@
# hledger check
#!/usr/bin/env -S hledger check -f
1

4
hledger/test/errors/showall Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env sh
# execute all journals, showing their error message
for f in *.j; do echo $f:; ./$f || true; done

2
hledger/test/errors/unbalanced-txn.j Normal file → Executable file
View File

@ -1,4 +1,4 @@
# hledger check
#!/usr/bin/env -S hledger check -f
1/1
a 1

2
hledger/test/errors/undeclared-acct.j Normal file → Executable file
View File

@ -1,4 +1,4 @@
# hledger check accounts
#!/usr/bin/env -S hledger check accounts -f
1/1
(a) 1

2
hledger/test/errors/undeclared-commodity.j Normal file → Executable file
View File

@ -1,4 +1,4 @@
# hledger check commodities
#!/usr/bin/env -S hledger check commodities -f
account a

2
hledger/test/errors/undeclared-payee.j Normal file → Executable file
View File

@ -1,4 +1,4 @@
# hledger check payees
#!/usr/bin/env -S hledger check payees -f
account a
commodity A

2
hledger/test/errors/unordered-dates.j Normal file → Executable file
View File

@ -1,4 +1,4 @@
# hledger check ordereddates
#!/usr/bin/env -S hledger check ordereddates -f
account a
commodity 1.