;dev: update error message tests

This commit is contained in:
Simon Michael 2024-03-26 10:12:46 -10:00
parent fae6e49407
commit 4ab55b3757
32 changed files with 122 additions and 198 deletions

View File

@ -156,7 +156,7 @@ Click error names to see an example. The table headings mean:
<!-- GENERATED: -->
hledger 1.26.99-ge777ae46f-20220803 error messages:
hledger 1.32.99-g4dbd417c9-20240326 error messages:
### accounts
```
@ -181,15 +181,13 @@ hledger: Error: /Users/simon/src/hledger/hledger/test/errors/./assertions.j:4:8:
4 | a 0 = 1
| ^^^
This balance assertion failed.
In account: a
and commodity:
this balance was asserted: 1
but the calculated balance is: 0
To troubleshoot, you can view this account's running balance. Eg:
hledger reg 'a$' cur: -I # -f FILE
Balance assertion failed in a
In commodity "" at this point, excluding subaccounts, ignoring costs,
the asserted balance is: 1
but the calculated balance is: 0
(difference: 1)
To troubleshoot, check this account's running balance with assertions disabled, eg:
hledger reg -I 'a$' cur:
```
@ -207,8 +205,8 @@ Consider adjusting this entry's amounts, or adding missing postings.
### balanced
```
hledger: Error: /Users/simon/src/hledger/hledger/test/errors/./balanced.j:6-8:
6 | 2022-01-01
hledger: Error: /Users/simon/src/hledger/hledger/test/errors/./balanced.j:5-7:
5 | 2022-01-01
| a 1 A
| b -1 B
@ -259,7 +257,7 @@ hledger: Error: /Users/simon/src/hledger/hledger/test/errors/./parseable-dates.j
3 | 2022/1/32
| ^^^^^^^^^
This date is invalid, please correct it: 2022/1/32
This is not a valid date, please fix it.
```
@ -303,21 +301,20 @@ payee p
### recentassertions
```
hledger: Error: /Users/simon/src/hledger/hledger/test/errors/./recentassertions.j:5:8:
| 2022-01-01 *
5 | a 0 = 0
| ^^^
hledger: Error: /Users/simon/src/hledger/hledger/test/errors/./recentassertions.j:11:
| 2022-01-09 bad1
11 | a 0
| ^
The recentassertions check is enabled, so accounts with balance assertions must
have a balance assertion no more than 7 days before their latest posting date.
In account a,
the last balance assertion (2022-01-01) was 8 days before
the latest posting (2022-01-09).
have a balance assertion within 7 days of their latest posting.
In account "a", this posting is 8 days later
than the last balance assertion, which was on 2022-01-01.
Consider adding a more recent balance assertion for this account. Eg:
2022-08-03 *
a $0 = $0 ; <- adjust
2024-03-26
a 0 = 0 ; (adjust asserted amount)
```

View File

@ -1,7 +1,5 @@
# * accounts error
# ** 1.
$ hledger check accounts -f accounts.j
>2 /hledger: Error: .*accounts.j:4:
$$$ hledger check accounts -f accounts.j
>>>2 /hledger: Error: .*accounts.j:4:
\| 2022-01-01
4 \| \(a\) 1
\| \^
@ -14,4 +12,4 @@ account a
account a ; type:A ; \(L,E,R,X,C,V\)
/
>= 1
>>>= 1

View File

@ -1,8 +1,6 @@
# * assertions error
# ** 1.
$ hledger check -f assertions.j
>2 /hledger: Error: .*assertions.j:4:8:
.*
$$$ hledger check -f assertions.j
>>>2 /hledger: Error: .*assertions.j:4:8:
\| 2022-01-01
4 \| a 0 = 1
\| \^\^\^
@ -10,7 +8,5 @@ Balance assertion failed in a
In commodity "" at this point, excluding subaccounts, ignoring costs,
the asserted balance is: 1
but the calculated balance is: 0
\(difference: 1\)
/
>= 1
\(difference: /
>>>= 1

View File

@ -1,7 +1,5 @@
# * autobalanced error
# ** 1.
$ hledger check -f autobalanced.j
>2 /hledger: Error: .*autobalanced.j:3-4:
$$$ hledger check -f autobalanced.j
>>>2 /hledger: Error: .*autobalanced.j:3-4:
3 \| 2022-01-01
\| a 1
@ -9,4 +7,4 @@ This transaction is unbalanced.
The real postings' sum should be 0 but is: 1
Consider adjusting this entry's amounts, or adding missing postings.
/
>= 1
>>>= 1

View File

@ -1,7 +1,6 @@
#!/usr/bin/env -S hledger check balancednoautoconversion -f
# Show the error when balancedwithautoconversion is required
# and an implicit commodity conversion is found.
# Currently the same as the regular balancedwithautoconversion error.
#!/usr/bin/env -S hledger check balanced -f
# Show the error when explicit conversion is required ("balanced")
# but an implicit commodity conversion is found.
2022/1/1
a 1 A

View File

@ -1,13 +1,11 @@
# * balanced error
# ** 1.
$ hledger check balanced -f balanced.j
>2 /hledger: Error: .*balanced.j:6-8:
6 \| 2022-01-01
$$$ hledger check balanced -f balanced.j
>>>2 /hledger: Error: .*balanced.j:5-7:
5 \| 2022-01-01
\| a 1 A
\| b -1 B
This multi-commodity transaction is unbalanced.
Automatic commodity conversion is not enabled.
The real postings' sum should be 0 but is: 1 A, -1 B
Consider adjusting this entry's/
>= 1
Consider adjusting this entry's amounts, adding/
>>>= 1

View File

@ -1,7 +1,5 @@
# * commodities error
# ** 1.
$ hledger check commodities -f commodities.j
>2 /hledger: Error: .*commodities.j:6:
$$$ hledger check commodities -f commodities.j
>>>2 /hledger: Error: .*commodities.j:6:
\| 2022-01-01
6 \| \(a\) A 1
\| \^\^\^
@ -14,4 +12,4 @@ commodity A1000.00
commodity 1.000,00 A
/
>= 1
>>>= 1

View File

@ -1,7 +1,5 @@
# * csvamountonenonzero error
# ** 1.
$ hledger check -f csvamountonenonzero.csv
>2 /hledger: Error: in CSV rules:
$$$ hledger check -f csvamountonenonzero.csv
>>>2 /hledger: Error: in CSV rules:
While processing CSV record: "2022-01-03","1","2"
while calculating amount for posting 1
rule "amount-in %2" assigned value "1"
@ -9,4 +7,4 @@ rule "amount-out %3" assigned value "2"
Multiple non-zero amounts were assigned for an amount field.
Please ensure just one non-zero amount i/
>= 1
>>>= 1

View File

@ -1,7 +1,5 @@
# * csvamountparse error
# ** 1.
$ hledger check -f csvamountparse.csv
>2 /hledger: Error: error: could not parse "badamount" as an amount
$$$ hledger check -f csvamountparse.csv
>>>2 /hledger: Error: error: could not parse "badamount" as an amount
CSV record: "2022-01-03","badamount"
the amount rule is: %2
the date rule is: %1
@ -14,4 +12,4 @@ unexpected end of input
expecting '\+', '-', or number
you may need to change your am/
>= 1
>>>= 1

View File

@ -1,7 +1,5 @@
# * csvbalanceparse error
# ** 1.
$ hledger check -f csvbalanceparse.csv
>2 /hledger: Error: error: could not parse "badbalance" as balance1 amount
$$$ hledger check -f csvbalanceparse.csv
>>>2 /hledger: Error: error: could not parse "badbalance" as balance1 amount
CSV record: "2022-01-03","badbalance"
the balance rule is: %2
the date rule is: %1
@ -15,4 +13,4 @@ expecting '\+', '-', or number
/
>= 1
>>>= 1

View File

@ -1,11 +1,9 @@
# * csvbalancetypeparse error
# ** 1.
$ hledger check -f csvbalancetypeparse.csv
>2 /hledger: Error: balance-type "badtype" is invalid. Use =, ==, =\* or ==\*.
$$$ hledger check -f csvbalancetypeparse.csv
>>>2 /hledger: Error: balance-type "badtype" is invalid. Use =, ==, =\* or ==\*.
CSV record: "2022-01-01","1"
the balance rule is: %2
the date rule is: %1
/
>= 1
>>>= 1

View File

@ -1,5 +1,3 @@
# * csvdateformat error
# ** 1.
$$$ hledger print -f csvdateformat.csv
>>>2 /hledger: Error: error: could not parse "a" as a date using date format "YYYY\/M\/D", "YYYY-M-D" or "YYYY.M.D"
CSV record: "a","b"

View File

@ -1,10 +1,8 @@
# * csvdateparse error
# ** 1.
$ hledger check -f csvdateparse.csv
>2 /hledger: Error: error: could not parse "baddate" as a date using date format "%Y-%m-%d"
$$$ hledger check -f csvdateparse.csv
>>>2 /hledger: Error: error: could not parse "baddate" as a date using date format "%Y-%m-%d"
CSV record: "baddate","b"
the date rule is: %1
the date-format is: %Y-%m-%d
you may need to change your date rule, change your date-format rule, or change your skip rule
for m\/d\/y or d\/m\/y dates, use date-f/
>= 1
>>>= 1

View File

@ -1,8 +1,6 @@
# * csvdaterule error
# ** 1.
$ hledger check -f csvdaterule.csv
>2 /hledger: Error: offset=0:
$$$ hledger check -f csvdaterule.csv
>>>2 /hledger: Error: offset=0:
Please specify \(at top level\) the date field. Eg: date %1
/
>= 1
>>>= 1

View File

@ -1,6 +1,4 @@
# * csvdecimalmarkparse error
# ** 1.
$ hledger check -f csvdecimalmarkparse.csv
>2 /hledger: Error: decimal-mark's argument should be "." or "," \(not "badmark"\)
$$$ hledger check -f csvdecimalmarkparse.csv
>>>2 /hledger: Error: decimal-mark's argument should be "." or "," \(not "badmark"\)
/
>= 1
>>>= 1

View File

@ -1,7 +1,5 @@
# * csvifblocknonempty error
# ** 1.
$ hledger check -f csvifblocknonempty.csv
>2 /hledger: Error: .*csvifblocknonempty.csv.rules:2:1:
$$$ hledger check -f csvifblocknonempty.csv
>>>2 /hledger: Error: .*csvifblocknonempty.csv.rules:2:1:
\|
2 \| if foo
\| \^
@ -9,4 +7,4 @@ start of conditional block found, but no assignment rules afterward
\(assignment rules in a conditional block should be indented\)
/
>= 1
>>>= 1

View File

@ -1,10 +1,8 @@
# * csviftablefieldnames error
# ** 1.
$ hledger check -f csviftablefieldnames.csv
>2 /hledger: Error: .*csviftablefieldnames.csv.rules:2:9:
$$$ hledger check -f csviftablefieldnames.csv
>>>2 /hledger: Error: .*csviftablefieldnames.csv.rules:2:9:
\|
2 \| if,date,nosuchfield,description
\| \^\^\^\^\^\^\^\^\^\^\^\^
unexpected "nosuchfield,"
expecting "account1", "account10", "account11", "account12", "account13", "account14", "account15", "account16", "account17", "account18", "/
>= 1
>>>= 1

View File

@ -1,11 +1,9 @@
# * csviftablenonempty error
# ** 1.
$ hledger check -f csviftablenonempty.csv
>2 /hledger: Error: .*csviftablenonempty.csv.rules:2:1:
$$$ hledger check -f csviftablenonempty.csv
>>>2 /hledger: Error: .*csviftablenonempty.csv.rules:2:1:
\|
2 \| if,date,description,comment
\| \^
start of conditional table found, but no assignment rules afterward
/
>= 1
>>>= 1

View File

@ -1,11 +1,9 @@
# * csviftablevaluecount error
# ** 1.
$ hledger check -f csviftablevaluecount.csv
>2 /hledger: Error: .*csviftablevaluecount.csv.rules:4:1:
$$$ hledger check -f csviftablevaluecount.csv
>>>2 /hledger: Error: .*csviftablevaluecount.csv.rules:4:1:
\|
4 \| one,val1
\| \^
line of conditional table should have 2 values, but this one has only 1
/
>= 1
>>>= 1

View File

@ -1,6 +1,4 @@
# * csvnoinclude error
# ** 1.
$ hledger check -f csvnoinclude.j
>2 /hledger: Error: sorry, CSV files can't be included yet
$$$ hledger check -f csvnoinclude.j
>>>2 /hledger: Error: sorry, CSV files can't be included yet
/
>= 1
>>>= 1

View File

@ -1,6 +1,4 @@
# * csvskipvalue error
# ** 1.
$ hledger check -f csvskipvalue.csv
>2 /hledger: Error: could not parse skip value: "badval"
$$$ hledger check -f csvskipvalue.csv
>>>2 /hledger: Error: could not parse skip value: "badval"
/
>= 1
>>>= 1

View File

@ -1,7 +1,5 @@
# * csvstatusparse error
# ** 1.
$ hledger print -f csvstatusparse.csv
>2 /hledger: Error: error: could not parse "badstatus" as a cleared status \(should be \*, ! or empty\)
$$$ hledger print -f csvstatusparse.csv
>>>2 /hledger: Error: error: could not parse "badstatus" as a cleared status \(should be \*, ! or empty\)
the parse error is: 1:1:
\|
1 \| badstatus
@ -11,4 +9,4 @@ expecting '!', '\*', or end of input
/
>= 1
>>>= 1

View File

@ -1,6 +1,4 @@
# * csvstdinrules error
# ** 1.
$ sh csvstdinrules.sh
>2 /hledger: Error: please use --rules-file when reading CSV from stdin
$$$ sh csvstdinrules.sh
>>>2 /hledger: Error: please use --rules-file when reading CSV from stdin
/
>= 1
>>>= 1

View File

@ -1,6 +1,4 @@
# * csvtwofields error
# ** 1.
$ hledger check -f csvtwofields.csv
>2 /hledger: Error: CSV record \["b"\] has less than two fields
$$$ hledger check -f csvtwofields.csv
>>>2 /hledger: Error: CSV record \["b"\] has less than two fields
/
>= 1
>>>= 1

View File

@ -1,7 +1,5 @@
# * ordereddates error
# ** 1.
$ hledger check ordereddates -f ordereddates.j
>2 /hledger: Error: .*ordereddates.j:10:
$$$ hledger check ordereddates -f ordereddates.j
>>>2 /hledger: Error: .*ordereddates.j:10:
7 \| 2022-01-02 p
\| \(a\) 1
@ -12,4 +10,4 @@ $ hledger check ordereddates -f ordereddates.j
Ordered dates checking is enabled, and this transaction's
date \(2022-01-01\) is out of order with the previous transaction.
Consider/
>= 1
>>>= 1

View File

@ -1,7 +1,5 @@
# * parseable error
# ** 1.
$ hledger check -f parseable-regexps.j
>2 /hledger: Error: .*parseable-regexps.j:3:8:
$$$ hledger check -f parseable-regexps.j
>>>2 /hledger: Error: .*parseable-regexps.j:3:8:
\|
3 \| alias \/\(\/ = a
\| \^
@ -10,4 +8,4 @@ This regular expression is malformed, please correct it:
\(
/
>= 1
>>>= 1

View File

@ -1,7 +1,5 @@
# * parseable error
# ** 1.
$ hledger check -f parseable.j
>2 /hledger: Error: .*parseable.j:3:2:
$$$ hledger check -f parseable.j
>>>2 /hledger: Error: .*parseable.j:3:2:
\|
3 \| 1
\| \^
@ -9,4 +7,4 @@ unexpected newline
expecting date separator or digit
/
>= 1
>>>= 1

View File

@ -1,7 +1,5 @@
# * payees error
# ** 1.
$ hledger check payees -f payees.j
>2 /hledger: Error: .*payees.j:6:
$$$ hledger check payees -f payees.j
>>>2 /hledger: Error: .*payees.j:6:
6 \| 2022-01-01 p
\| \^
\| \(a\) A 1
@ -13,4 +11,4 @@ Consider adding a payee directive. Examples:
payee p
/
>= 1
>>>= 1

View File

@ -1,23 +1,11 @@
# * check recentassertions errorsrecentassertions error
# ** 1. The first posting more than 7 days after latest balance assertion causes this check to fail.
$ hledger check recentassertions -f recentassertions.j
>2 /Error: .*recentassertions.j:11:
| 2022-01-09 bad1
11 | a 0
| \^
/
>= 1
#
#The recentassertions check is enabled, so accounts with balance assertions must
#have a balance assertion within 7 days of their latest posting.
#In account "a", the above posting is 8 days later
#than the last balance assertion, which was on 2022-01-01.
#
#Consider adding a more recent balance assertion for this account. Eg:
#
#....-..-..
# a \$0 = \$0 ; \(adjust asserted amount\)
#/
#>= 1
# XXX shelltestrunner: "ERROR: please avoid regexps larger than 300 characters, they trigger a memory leak in regex-tdfa".
# Still true ?
$$$ hledger check recentassertions -f recentassertions.j
>>>2 /hledger: Error: .*recentassertions.j:11:
\| 2022-01-09 bad1
11 \| a 0
\| \^
The recentassertions check is enabled, so accounts with balance assertions must
have a balance assertion within 7 days of their latest posting.
In account "a", this posting is 8 days later
than t/
>>>= 1

View File

@ -1,7 +1,5 @@
# * tcclockouttime error
# ** 1.
$ hledger check -f tcclockouttime.timeclock
>2 /hledger: Error: .*tcclockouttime.timeclock:5:1:
$$$ hledger check -f tcclockouttime.timeclock
>>>2 /hledger: Error: .*tcclockouttime.timeclock:5:1:
\| i 2022-01-01 00:01:00
5 \| o 2022-01-01 00:00:00
\| \^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^
@ -9,4 +7,4 @@ $ hledger check -f tcclockouttime.timeclock
This clockout time \(2022-01-01 00:00:00\) is earlier than the previous clockin.
Please adjust it to be later than 2022-01-01 00:01:00.
/
>= 1
>>>= 1

View File

@ -1,7 +1,5 @@
# * tcorderedactions error
# ** 1.
$ hledger check -f tcorderedactions.timeclock
>2 /hledger: Error: .*tcorderedactions.timeclock:8:1:
$$$ hledger check -f tcorderedactions.timeclock
>>>2 /hledger: Error: .*tcorderedactions.timeclock:8:1:
8 \| i 2022-01-01 00:01:00
\| \^
@ -9,4 +7,4 @@ Expected a timeclock o entry but got i.
Only one session may be clocked in at a time.
Please alternate i and o, beginning with i.
/
>= 1
>>>= 1

View File

@ -1,7 +1,5 @@
# * uniqueleafnames error
# ** 1.
$ hledger check uniqueleafnames -f uniqueleafnames.j
>2 /hledger: Error: .*uniqueleafnames.j:12:
$$$ hledger check uniqueleafnames -f uniqueleafnames.j
>>>2 /hledger: Error: .*uniqueleafnames.j:12:
\| 2022-01-01 p
9 \| \(a:c\) 1
...
@ -12,4 +10,4 @@ $ hledger check uniqueleafnames -f uniqueleafnames.j
Checking for unique account leaf names is enabled, and
account leaf name "c" is not unique.
It appears in these account names, which a/
>= 1
>>>= 1