test: errors: show current errors in doc, generated by showall

This commit is contained in:
Simon Michael 2022-03-18 08:25:58 -10:00
parent f7625343f6
commit eaa6e202f3
2 changed files with 170 additions and 14 deletions

View File

@ -20,18 +20,19 @@ highlighting, not to mention LSP support, for all of our journal
errors is a big project, but it's crowd-sourceable and any progress
brings immediate practical benefits. Here is the approximate current status:
| | consistent | accurate line | accurate column | flycheck detects | flycheck region |
|-------------------|------------|---------------|-----------------|------------------|-----------------|
| parseable | | | | Y | |
| parseable-dates | | | | Y | |
| parseable-regexps | | | | Y | |
| balanced | | | | Y | |
| assertions | | | | Y | |
| accounts | | | | Y | |
| commodities | | | | Y | |
| payees | | | | Y | |
| ordereddates | | | | Y | |
| uniqueleafnames | | | | Y | |
| | consistent | accurate line | accurate column | flycheck detects | flycheck region |
|--------------------------|------------|---------------|-----------------|------------------|-----------------|
| parseable | | | | Y | |
| parseable-dates | | | | Y | |
| parseable-regexps | | | | Y | |
| balanced | | | | Y | |
| balancednoautoconversion | | | | Y | |
| assertions | | | | Y | |
| accounts | | | | Y | |
| commodities | | | | Y | |
| payees | | | | Y | |
| ordereddates | | | | Y | |
| uniqueleafnames | | | | Y | |
Key:
- consistent: the error message follows a consistent format
@ -39,3 +40,134 @@ Key:
- accurate column - the optimal column(s) is(are) selected
- flycheck detects - flycheck recognises the error output, reports the error and doesn't give a "suspicious" warning
- flycheck shows region - flycheck highlights the text region containing the error
## Current journal errors
<!-- to update: erase the below then C-u M-! ./showall -->
hledger 1.25.99-ge6bf04fce-20220316 error messages, last updated 2022-03-18:
### parseable
```
hledger: /Users/simon/src/hledger/hledger/test/errors/./parseable.j:3:2:
|
3 | 1
| ^
unexpected newline
expecting date separator or digit
```
### parseable-dates
```
hledger: /Users/simon/src/hledger/hledger/test/errors/./parseable-dates.j:3:1:
|
3 | 2022/1/32
| ^^^^^^^^^
well-formed but invalid date: 2022/1/32
```
### parseable-regexps
```
hledger: /Users/simon/src/hledger/hledger/test/errors/./parseable-regexps.j:3:8:
|
3 | alias /(/ = a
| ^
this regular expression could not be compiled: (
```
### balanced
```
hledger: /Users/simon/src/hledger/hledger/test/errors/./balanced.j:3-4
could not balance this transaction:
real postings' sum should be 0 but is: 1
2022-01-01
a 1
```
### balancednoautoconversion
```
hledger: /Users/simon/src/hledger/hledger/test/errors/./balancednoautoconversion.j:6-8
could not balance this transaction:
real postings' sum should be 0 but is: 1 A
-1 B
2022-01-01
a 1 A
b -1 B
```
### assertions
```
hledger: balance assertion: /Users/simon/src/hledger/hledger/test/errors/./assertions.j:4:8
transaction:
2022-01-01
a 0 = 1
assertion details:
date: 2022-01-01
account: a
commodity:
calculated: 0
asserted: 1
difference: 1
```
### accounts
```
Error: undeclared account "a"
in transaction at: /Users/simon/src/hledger/hledger/test/errors/./accounts.j:3-4
2022-01-01
(a) 1
```
### commodities
```
Error: undeclared commodity "A"
in transaction at: /Users/simon/src/hledger/hledger/test/errors/./commodities.j:5-6
2022-01-01
(a) A 1
```
### payees
```
Error: undeclared payee "p"
at: /Users/simon/src/hledger/hledger/test/errors/./payees.j:6-7
> 2022-01-01 p
(a) A 1
```
### ordereddates
```
Error: transaction date is out of order
at /Users/simon/src/hledger/hledger/test/errors/./ordereddates.j:10-11:
2022-01-02 p
(a) 1
> 2022-01-01 p
(a) 1
```
### uniqueleafnames
```
Error: account leaf names are not unique
leaf name "c" appears in account names: "a:c", "b:c"
seen in "a:c" in transaction at: /Users/simon/src/hledger/hledger/test/errors/./uniqueleafnames.j:8-9
> 2022-01-01 p
> (a:c) 1
```

View File

@ -1,4 +1,28 @@
#!/usr/bin/env sh
# execute all journals, showing their error message
# Execute all test journals, showing their error messages
# (as README-ready markdown).
for f in *.j; do echo $f:; ./$f || true; done
# All test journals in this directory, in preferred test/display order
testfiles="\
parseable.j \
parseable-dates.j \
parseable-regexps.j \
balanced.j \
balancednoautoconversion.j \
assertions.j \
accounts.j \
commodities.j \
payees.j \
ordereddates.j \
uniqueleafnames.j \
"
printf '%s error messages, last updated %s:\n\n' \
"$(hledger --version | cut -d, -f1)" \
"$(date +%Y-%m-%d)"
for f in $testfiles; do
printf '### %s\n```\n' "$(echo "$f" | cut -d. -f1)"
./"$f" || true
printf '```\n\n'
done