diff --git a/hledger/test/errors/README.md b/hledger/test/errors/README.md index d49833cca..10f3e872f 100644 --- a/hledger/test/errors/README.md +++ b/hledger/test/errors/README.md @@ -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 + + +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 + +``` + diff --git a/hledger/test/errors/showall b/hledger/test/errors/showall index ea789cba8..aa619a12b 100755 --- a/hledger/test/errors/showall +++ b/hledger/test/errors/showall @@ -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