dev: make func tests compatible with ghc 9.10

Work around ghc 9.10's extra newline in error output.
https://gitlab.haskell.org/ghc/ghc/-/issues/25116
This commit is contained in:
Simon Michael 2024-09-30 14:17:55 -10:00
parent 1c45496f1c
commit fd930ff567
7 changed files with 67 additions and 59 deletions

View File

@ -26,6 +26,9 @@ and a test number (`1. `), useful for running individual tests.
A few tests invoke unix commands; these won't run in a Windows CMD shell.
2024-09-30 Note: tests of error output must use regexps for now to work
around ghc 9.10's extra newline in error output: https://gitlab.haskell.org/ghc/ghc/-/issues/25116
[Developer docs > TESTS]: https://hledger.org/TESTS.html
[component]: https://hledger.org/CONTRIBUTING.html#components
[shelltestrunner]: https://github.com/simonmichael/shelltestrunner#readme

View File

@ -774,14 +774,15 @@ if|account2|comment
%amount 150|acct2
%description Flubber|acct|
$ ./csvtest.sh
>2
hledger: Error: input.rules:6:1:
|
6 | %amount 150|acct2
| ^
>2 /hledger: Error: input.rules:6:1:
\|
6 \| %amount 150\|acct2
\| \^
line of conditional table should have 2 values, but this one has only 1
/
>=1
# XXX regex needed for error tests with ghc 9.10, https://gitlab.haskell.org/ghc/ghc/-/issues/25116
# ** 40. unindented condition block error
<
@ -796,15 +797,16 @@ if Flubber
account2 acct
comment cmt
$ ./csvtest.sh
>2
hledger: Error: input.rules:5:1:
|
5 | if Flubber
| ^
>2 /hledger: Error: input.rules:5:1:
\|
5 \| if Flubber
\| \^
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
# XXX
# ** 41. Assignment to custom field (#1264) + spaces after the if (#1120)
<
@ -822,15 +824,16 @@ if Flubber
account2 %myaccount2
$ ./csvtest.sh
>2
hledger: Error: input.rules:6:3:
|
6 | myaccount2 acct
| ^^^^^^^^^^^^
>2 /hledger: Error: input.rules:6:3:
\|
6 \| myaccount2 acct
\| \^\^\^\^\^\^\^\^\^\^\^\^
unexpected "myaccount2 a"
expecting conditional block
/
>=1
# XXX
# ** 42. Rules override each other in the order listed in the file
<
@ -870,15 +873,16 @@ if account2 comment
%amount 150 acct2
%description Flubber acct
$ ./csvtest.sh
>2
hledger: Error: input.rules:5:1:
|
5 | if account2 comment
| ^
>2 /hledger: Error: input.rules:5:1:
\|
5 \| if account2 comment
\| \^
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
# XXX
# ** 44. handle conditions with & operator
<

View File

@ -170,15 +170,16 @@ Balance changes in 2016-10-01..2017-01-31:
# ** 9. Parse error in malformed forecast period expression
$ hledger bal -M -b 2016-10 -e 2017-02 -f - --forecast=20160801-foobar
>
>2
hledger: Error: could not parse forecast period : 1:10:
|
1 | 20160801-foobar
| ^
>2 /hledger: Error: could not parse forecast period : 1:10:
\|
1 \| 20160801-foobar
\| \^
unexpected 'f'
expecting end of input
(use -h to see usage)
\(use -h to see usage\)
/
>=1
# XXX regex needed for error tests with ghc 9.10, https://gitlab.haskell.org/ghc/ghc/-/issues/25116
<
commodity 1,000.00 USD

View File

@ -73,30 +73,32 @@ Expenses:Food
account (a)
$ hledger -f- accounts
>2
hledger: Error: -:1:9:
|
1 | account (a)
| ^
unexpected '('
>2 /hledger: Error: -:1:9:
\|
1 \| account \(a\)
\| \^
unexpected '\('
expecting account name without brackets
/
>=1
# XXX regex needed for error tests with ghc 9.10, https://gitlab.haskell.org/ghc/ghc/-/issues/25116
# ** 6. It does not allow brackets in names.
<
account [a]
$ hledger -f- accounts
>2
hledger: Error: -:1:9:
|
1 | account [a]
| ^
unexpected '['
>2 /hledger: Error: -:1:9:
\|
1 \| account \[a\]
\| \^
unexpected '\['
expecting account name without brackets
/
>=1
# XXX regex needed for error tests with ghc 9.10, https://gitlab.haskell.org/ghc/ghc/-/issues/25116
# TODO
# a trailing : should give a clear error

View File

@ -6,15 +6,16 @@
2018
$ hledger -f - print
>2
hledger: Error: -:1:5:
|
1 | 2018
| ^
>2 /hledger: Error: -:1:5:
\|
1 \| 2018
\| \^
unexpected newline
expecting date separator or digit
/
>=1
# XXX regex needed for error tests with ghc 9.10, https://gitlab.haskell.org/ghc/ghc/-/issues/25116
# A journal with an unbalanced transaction.
<
@ -122,18 +123,17 @@ $ hledger -f- print
b 1B
$ hledger -f- print
>2
hledger: Error: -:1-3:
1 | 2020-01-01
| a 1A
| b 1B
>2 /hledger: Error: -:1-3:
1 \| 2020-01-01
\| a 1A
\| b 1B
This multi-commodity transaction is unbalanced.
The real postings all have the same sign. Consider negating some of them.
Consider adjusting this entry's amounts, adding missing postings,
or recording conversion price(s) with @, @@ or equity postings.
/
>=1
#'
# XXX regex needed for error tests with ghc 9.10, https://gitlab.haskell.org/ghc/ghc/-/issues/25116
# ** 12. Typical "hledger equity --close" transaction does not trigger sign error.
<

View File

@ -129,10 +129,11 @@ $ hledger -f - print expr:"not tag:transactiontag=B"
# ** 9. Having parentheses directly follow 'not' sees 'not' as part of a query.
$ hledger -f - print expr:"not(tag:transactiontag=B)"
>2
hledger: Error: This regular expression is invalid or unsupported, please correct it:
not(tag:transactiontag=B
>2 /hledger: Error: This regular expression is invalid or unsupported, please correct it:
not\(tag:transactiontag=B
/
>=1
# XXX regex needed for error tests with ghc 9.10, https://gitlab.haskell.org/ghc/ghc/-/issues/25116
# ** 10. ... whereas parentheses with a space between 'not' and '(' is fine.
$ hledger -f - print expr:"not (tag:transactiontag=B)"

View File

@ -236,10 +236,7 @@ $ hledger -f- roi -p 2019-11
Assets:Checking 101 A
Unrealized PnL
$ hledger -f- roi -p 2019-11 --inv Investment --pnl PnL
>2
hledger: Error: Amounts could not be converted to a single commodity: ["10 B","-9 B @@ 100 A","100 C"]
Consider using --value to force all costs to be in a single commodity.
For example, "--value=end,<commodity> --infer-market-prices", where commodity is the one that was used for investment valuations.
>2 /hledger: Error: Amounts could not be converted to a single commodity: \["10 B","-9 B @@ 100 A","100 C"\]/
>= 1
# ** 10. Forcing valuation via --value