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

View File

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

View File

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

View File

@ -1,7 +1,5 @@
# * autobalanced error $$$ hledger check -f autobalanced.j
# ** 1. >>>2 /hledger: Error: .*autobalanced.j:3-4:
$ hledger check -f autobalanced.j
>2 /hledger: Error: .*autobalanced.j:3-4:
3 \| 2022-01-01 3 \| 2022-01-01
\| a 1 \| a 1
@ -9,4 +7,4 @@ This transaction is unbalanced.
The real postings' sum should be 0 but is: 1 The real postings' sum should be 0 but is: 1
Consider adjusting this entry's amounts, or adding missing postings. 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 #!/usr/bin/env -S hledger check balanced -f
# Show the error when balancedwithautoconversion is required # Show the error when explicit conversion is required ("balanced")
# and an implicit commodity conversion is found. # but an implicit commodity conversion is found.
# Currently the same as the regular balancedwithautoconversion error.
2022/1/1 2022/1/1
a 1 A a 1 A

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,5 @@
# * csvbalanceparse error $$$ hledger check -f csvbalanceparse.csv
# ** 1. >>>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" CSV record: "2022-01-03","badbalance"
the balance rule is: %2 the balance rule is: %2
the date rule is: %1 the date rule is: %1
@ -15,4 +13,4 @@ expecting '\+', '-', or number
/ /
>= 1 >>>= 1

View File

@ -1,11 +1,9 @@
# * csvbalancetypeparse error $$$ hledger check -f csvbalancetypeparse.csv
# ** 1. >>>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" CSV record: "2022-01-01","1"
the balance rule is: %2 the balance rule is: %2
the date rule is: %1 the date rule is: %1
/ /
>= 1 >>>= 1

View File

@ -1,5 +1,3 @@
# * csvdateformat error
# ** 1.
$$$ hledger print -f csvdateformat.csv $$$ 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" >>>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" CSV record: "a","b"

View File

@ -1,10 +1,8 @@
# * csvdateparse error $$$ hledger check -f csvdateparse.csv
# ** 1. >>>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" CSV record: "baddate","b"
the date rule is: %1 the date rule is: %1
the date-format is: %Y-%m-%d 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 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/ for m\/d\/y or d\/m\/y dates, use date-f/
>= 1 >>>= 1

View File

@ -1,8 +1,6 @@
# * csvdaterule error $$$ hledger check -f csvdaterule.csv
# ** 1. >>>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 Please specify \(at top level\) the date field. Eg: date %1
/ /
>= 1 >>>= 1

View File

@ -1,6 +1,4 @@
# * csvdecimalmarkparse error $$$ hledger check -f csvdecimalmarkparse.csv
# ** 1. >>>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 $$$ hledger check -f csvifblocknonempty.csv
# ** 1. >>>2 /hledger: Error: .*csvifblocknonempty.csv.rules:2:1:
$ hledger check -f csvifblocknonempty.csv
>2 /hledger: Error: .*csvifblocknonempty.csv.rules:2:1:
\| \|
2 \| if foo 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\) \(assignment rules in a conditional block should be indented\)
/ /
>= 1 >>>= 1

View File

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

View File

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

View File

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

View File

@ -1,6 +1,4 @@
# * csvnoinclude error $$$ hledger check -f csvnoinclude.j
# ** 1. >>>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 $$$ hledger check -f csvskipvalue.csv
# ** 1. >>>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 $$$ hledger print -f csvstatusparse.csv
# ** 1. >>>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: the parse error is: 1:1:
\| \|
1 \| badstatus 1 \| badstatus
@ -11,4 +9,4 @@ expecting '!', '\*', or end of input
/ /
>= 1 >>>= 1

View File

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

View File

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

View File

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

View File

@ -1,23 +1,11 @@
# * check recentassertions errorsrecentassertions error $$$ hledger check recentassertions -f recentassertions.j
# ** 1. The first posting more than 7 days after latest balance assertion causes this check to fail. >>>2 /hledger: Error: .*recentassertions.j:11:
$ hledger check recentassertions -f recentassertions.j \| 2022-01-09 bad1
>2 /Error: .*recentassertions.j:11: 11 \| a 0
| 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.
>= 1 In account "a", this posting is 8 days later
# than t/
#The recentassertions check is enabled, so accounts with balance assertions must >>>= 1
#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 ?

View File

@ -1,7 +1,5 @@
# * tcclockouttime error $$$ hledger check -f tcclockouttime.timeclock
# ** 1. >>>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 \| i 2022-01-01 00:01:00
5 \| o 2022-01-01 00:00: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. 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. Please adjust it to be later than 2022-01-01 00:01:00.
/ /
>= 1 >>>= 1

View File

@ -1,7 +1,5 @@
# * tcorderedactions error $$$ hledger check -f tcorderedactions.timeclock
# ** 1. >>>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 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. Only one session may be clocked in at a time.
Please alternate i and o, beginning with i. Please alternate i and o, beginning with i.
/ /
>= 1 >>>= 1

View File

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