;dev:tests:errors: update readme, tests

This commit is contained in:
Simon Michael 2025-11-17 22:44:22 -10:00
parent 5849c78538
commit 22ea58a866
30 changed files with 75 additions and 62 deletions

View File

@ -159,20 +159,20 @@ Click error names to see an example. The table headings mean:
<!-- GENERATED: -->
hledger 1.40.99-gd6e34d8cd-20241102 error messages:
hledger 1.50.99-g9031612c3-20251117 error messages:
### accounts
```
hledger: Error: /Users/simon/src/hledger/hledger/test/errors/./accounts.j:4:
| 2022-01-01
4 | (a) 1
4 | (ß) 1
| ^
Strict account checking is enabled, and
account "a" has not been declared.
account "ß" has not been declared.
Consider adding an account directive. Examples:
account a
account ß
```
@ -201,7 +201,6 @@ hledger: Error: /Users/simon/src/hledger/hledger/test/errors/./autobalanced.j:3-
This transaction is unbalanced.
The real postings' sum should be 0 but is: 1
Consider adjusting this entry's amounts, or adding missing postings.
```
@ -340,31 +339,33 @@ Consider changing these account names so their last parts are different.
### tcclockouttime
```
hledger: Error: /Users/simon/src/hledger/hledger/test/errors/./tcclockouttime.timeclock:5:1:
| i 2022-01-01 00:01:00
hledger: Error: /Users/simon/src/hledger/hledger/test/errors/./tcclockouttime.timeclock:4:1:
4 | i 2022-01-01 00:01:00 a
/Users/simon/src/hledger/hledger/test/errors/./tcclockouttime.timeclock:5:1:
5 | o 2022-01-01 00:00:00
| ^^^^^^^^^^^^^^^^^^^
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.
:
This clockout is earlier than the clockin.
```
### tcorderedactions
```
hledger: Error: /Users/simon/src/hledger/hledger/test/errors/./tcorderedactions.timeclock:8:1:
8 | i 2022-01-01 00:01:00
| ^
8 | i 2022-01-01 00:01:00 a
Expected a timeclock o entry but got i.
Please alternate i and o, beginning with i.
overlaps with session beginning at:
/Users/simon/src/hledger/hledger/test/errors/./tcorderedactions.timeclock:7:1:
7 | i 2022-01-01 00:00:00 a
Overlapping sessions with the same account name are not supported.
```
### csvamountonenonzero
```
hledger: Error: in CSV rules:
While processing CSV record: "2022-01-03","1","2"
While processing record: 2022-01-03,1,2
while calculating amount for posting 1
rule "amount-in %2" assigned value "1"
rule "amount-out %3" assigned value "2"
@ -378,8 +379,8 @@ See also: https://hledger.org/hledger.html#setting-amounts
### csvamountparse
```
hledger: Error: error: could not parse "badamount" as an amount
CSV record: "2022-01-03","badamount"
hledger: Error: could not parse "badamount" as an amount
record: 2022-01-03,badamount
the amount rule is: %2
the date rule is: %1
@ -396,8 +397,8 @@ you may need to change your amount*, balance*, or currency* rules, or add or cha
### csvbalanceparse
```
hledger: Error: error: could not parse "badbalance" as balance1 amount
CSV record: "2022-01-03","badbalance"
hledger: Error: could not parse "badbalance" as balance1 amount
record: 2022-01-03,badbalance
the balance rule is: %2
the date rule is: %1
@ -413,7 +414,7 @@ expecting '+', '-', or number
### csvbalancetypeparse
```
hledger: Error: balance-type "badtype" is invalid. Use =, ==, =* or ==*.
CSV record: "2022-01-01","1"
record: 2022-01-01,1
the balance rule is: %2
the date rule is: %1
```
@ -421,8 +422,8 @@ the date rule is: %1
### csvdateformat
```
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"
hledger: Error: could not parse "a" as a date using date format "YYYY/M/D", "YYYY-M-D" or "YYYY.M.D"
record: a,b
the date rule is: %1
the date-format is: unspecified
you may need to change your date rule, add a date-format rule, or change your skip rule
@ -432,8 +433,8 @@ for m/d/y or d/m/y dates, use date-format %-m/%-d/%Y or date-format %-d/%-m/%Y
### csvdateparse
```
hledger: Error: error: could not parse "baddate" as a date using date format "%Y-%m-%d"
CSV record: "baddate","b"
hledger: Error: could not parse "baddate" as a date using date format "%Y-%m-%d"
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
@ -498,19 +499,24 @@ line of conditional table should have 2 values, but this one has only 1
### csvnoinclude
```
hledger: Error: sorry, CSV files can't be included yet
hledger: Error: in file included from /Users/simon/src/hledger/hledger/test/errors/./csvnoinclude.j,
/Users/simon/src/hledger/hledger/test/errors/csvnoinclude.csv:1:1:
|
1 | <empty line>
| ^
sorry, CSV files can't be included yet
```
### csvskipvalue
```
hledger: Error: could not parse skip value: "badval"
hledger: Error: could not parse skip value: badval
```
### csvstatusparse
```
hledger: Error: error: could not parse "badstatus" as a cleared status (should be *, ! or empty)
hledger: Error: could not parse status value "badstatus" (should be *, ! or empty)
the parse error is: 1:1:
|
1 | badstatus

View File

@ -1,5 +1,5 @@
$$$ hledger check accounts -f accounts.j
>>>2 /Error: .*accounts.j:4:
>>>2 /hledger: Error: .*accounts.j:4:
\| 2022-01-01
4 \| \(ß\) 1
\| \^

View File

@ -1,5 +1,5 @@
$$$ hledger check -f assertions.j
>>>2 /Error: .*assertions.j:4:8:
>>>2 /hledger: Error: .*assertions.j:4:8:
\| 2022-01-01
4 \| a 0 = 1
\| \^\^\^

View File

@ -1,5 +1,5 @@
$$$ hledger check -f autobalanced.j
>>>2 /Error: .*autobalanced.j:3-4:
>>>2 /hledger: Error: .*autobalanced.j:3-4:
3 \| 2022-01-01
\| a 1

View File

@ -1,10 +1,11 @@
$$$ hledger check balanced -f balanced.j
>>>2 /Error: .*balanced.j:5-7:
>>>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/
The real postings' sum should be 0 but is: 1 A, -1 B
Consider adjusting this entry's amounts, adding/
>>>= 1

View File

@ -1,5 +1,5 @@
$$$ hledger check commodities -f commodities.j
>>>2 /Error: .*commodities.j:6:
>>>2 /hledger: Error: .*commodities.j:6:
\| 2022-01-01
6 \| \(a\) A 1
\| \^\^\^

View File

@ -1,10 +1,10 @@
$$$ hledger check -f csvamountonenonzero.csv
>>>2 /Error: in CSV rules:
>>>2 /hledger: Error: in CSV rules:
While processing record: 2022-01-03,1,2
while calculating amount for posting 1
rule "amount-in %2" assigned value "1"
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/
Please ensure just one non-zero amount is assigned/
>>>= 1

View File

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

View File

@ -1,5 +1,5 @@
$$$ hledger check -f csvbalanceparse.csv
>>>2 /Error: could not parse "badbalance" as balance1 amount
>>>2 /hledger: Error: could not parse "badbalance" as balance1 amount
record: 2022-01-03,badbalance
the balance rule is: %2
the date rule is: %1

View File

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

View File

@ -1,8 +1,8 @@
$$$ hledger print -f csvdateformat.csv
>>>2 /Error: could not parse "a" as a date using date format "YYYY\/M\/D", "YYYY-M-D" or "YYYY.M.D"
>>>2 /hledger: Error: could not parse "a" as a date using date format "YYYY\/M\/D", "YYYY-M-D" or "YYYY.M.D"
record: a,b
the date rule is: %1
the date-format is: unspecified
you may need to change your date rule, add a date-format rule, or change your skip rule
for m\/d\/y or d\/m\/y date/
for m\/d\/y or d\/m\/y dates, use date-for/
>>>= 1

View File

@ -1,8 +1,8 @@
$$$ hledger check -f csvdateparse.csv
>>>2 /Error: could not parse "baddate" as a date using date format "%Y-%m-%d"
>>>2 /hledger: Error: could not parse "baddate" as a date using date format "%Y-%m-%d"
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/
for m\/d\/y or d\/m\/y dates, use date-format %-m\/%-d\//
>>>= 1

View File

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

View File

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

View File

@ -1,5 +1,5 @@
$$$ hledger check -f csvifblocknonempty.csv
>>>2 /Error: .*csvifblocknonempty.csv.rules:2:1:
>>>2 /hledger: Error: .*csvifblocknonempty.csv.rules:2:1:
\|
2 \| if foo
\| \^

View File

@ -1,5 +1,5 @@
$$$ hledger check -f csviftablefieldnames.csv
>>>2 /Error: .*csviftablefieldnames.csv.rules:2:9:
>>>2 /hledger: Error: .*csviftablefieldnames.csv.rules:2:9:
\|
2 \| if,date,nosuchfield,description
\| \^\^\^\^\^\^\^\^\^\^\^\^

View File

@ -1,5 +1,5 @@
$$$ hledger check -f csviftablenonempty.csv
>>>2 /Error: .*csviftablenonempty.csv.rules:2:1:
>>>2 /hledger: Error: .*csviftablenonempty.csv.rules:2:1:
\|
2 \| if,date,description,comment
\| \^

View File

@ -1,5 +1,5 @@
$$$ hledger check -f csviftablevaluecount.csv
>>>2 /Error: .*csviftablevaluecount.csv.rules:4:1:
>>>2 /hledger: Error: .*csviftablevaluecount.csv.rules:4:1:
\|
4 \| one,val1
\| \^

View File

@ -1,3 +1,9 @@
$$$ hledger check -f csvnoinclude.j
>>>2 /CSV files can't be included yet/
>>>2 /hledger: Error: .*csvnoinclude.j,
\/Users\/simon\/src\/hledger\/hledger\/test\/errors\/csvnoinclude.csv:1:1:
\|
1 \| <empty line>
\| \^
sorry, CSV files can't be included yet
/
>>>= 1

View File

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

View File

@ -1,5 +1,5 @@
$$$ hledger print -f csvstatusparse.csv
>>>2 /Error: could not parse status value "badstatus" \(should be \*, ! or empty\)
>>>2 /hledger: Error: could not parse status value "badstatus" \(should be \*, ! or empty\)
the parse error is: 1:1:
\|
1 \| badstatus

View File

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

View File

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

View File

@ -1,5 +1,5 @@
$$$ hledger check ordereddates -f ordereddates.j
>>>2 /Error: .*ordereddates.j:10:
>>>2 /hledger: Error: .*ordereddates.j:10:
7 \| 2022-01-02 p
\| \(a\) 1

View File

@ -1,5 +1,5 @@
$$$ hledger check -f parseable-dates.j
>>>2 /Error: .*parseable-dates.j:3:1:
>>>2 /hledger: Error: .*parseable-dates.j:3:1:
\|
3 \| 2022\/1\/32
\| \^\^\^\^\^\^\^\^\^

View File

@ -1,5 +1,5 @@
$$$ hledger check -f parseable-regexps.j
>>>2 /Error: .*parseable-regexps.j:3:8:
>>>2 /hledger: Error: .*parseable-regexps.j:3:8:
\|
3 \| alias \/\(\/ = a
\| \^

View File

@ -1,5 +1,5 @@
$$$ hledger check -f parseable.j
>>>2 /Error: .*parseable.j:3:2:
>>>2 /hledger: Error: .*parseable.j:3:2:
\|
3 \| 1
\| \^

View File

@ -1,5 +1,5 @@
$$$ hledger check payees -f payees.j
>>>2 /Error: .*payees.j:6:
>>>2 /hledger: Error: .*payees.j:6:
6 \| 2022-01-01 p
\| \^
\| \(a\) A 1

View File

@ -1,5 +1,5 @@
$$$ hledger check recentassertions -f recentassertions.j
>>>2 /Error: .*recentassertions.j:18:
>>>2 /hledger: Error: .*recentassertions.j:18:
\| 2022-01-09 bad1
18 \| a 0
\| \^

View File

@ -1,5 +1,5 @@
$$$ hledger check uniqueleafnames -f uniqueleafnames.j
>>>2 /Error: .*uniqueleafnames.j:12:
>>>2 /hledger: Error: .*uniqueleafnames.j:12:
\| 2022-01-01 p
9 \| \(a:c\) 1
...