When the error message repeated the invalid date at the end, it was possible to misinterpret that as a suggested fix (reported in chat). Instead, date errors (most of them) now rely on the highlighted data excerpt above. This is also preferable since it shows the original date as written, not a reconstruction with a possibly different format. Should this be the policy for all error messages going forward ? It would be easier. Can we assume the data excerpt is always visible along with the error message ? It isn't shown by flycheck-hledger in emacs, eg.
51 lines
658 B
Plaintext
51 lines
658 B
Plaintext
# * date parsing
|
|
|
|
# invalid dates should be rejected
|
|
|
|
# ** 1. valid month and day, but flipped
|
|
<
|
|
2010/31/12 x
|
|
a 1
|
|
b
|
|
$ hledger -f- print
|
|
>2 /is not a valid date/
|
|
>= 1
|
|
|
|
# ** 2. too-large day
|
|
<
|
|
2010/12/32 x
|
|
a 1
|
|
b
|
|
$ hledger -f- print
|
|
>2 /is not a valid date/
|
|
>= 1
|
|
|
|
# ** 3. 29th feb on leap year should be ok
|
|
<
|
|
2000/2/29 x
|
|
a 1
|
|
b
|
|
$ hledger -f- print
|
|
2000-02-29 x
|
|
a 1
|
|
b
|
|
|
|
>= 0
|
|
|
|
# ** 4. 29th feb on non-leap year should fail
|
|
<
|
|
2001/2/29 x
|
|
a 1
|
|
b
|
|
$ hledger -f- print
|
|
>2 /is not a valid date/
|
|
>= 1
|
|
|
|
# ** 5. dates must be followed by whitespace or newline
|
|
<
|
|
2015/9/6*
|
|
a 0
|
|
$ hledger -f- print
|
|
>2 /unexpected '*'/
|
|
>= 1
|