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. 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 [Developer docs > TESTS]: https://hledger.org/TESTS.html
[component]: https://hledger.org/CONTRIBUTING.html#components [component]: https://hledger.org/CONTRIBUTING.html#components
[shelltestrunner]: https://github.com/simonmichael/shelltestrunner#readme [shelltestrunner]: https://github.com/simonmichael/shelltestrunner#readme

View File

@ -774,14 +774,15 @@ if|account2|comment
%amount 150|acct2 %amount 150|acct2
%description Flubber|acct| %description Flubber|acct|
$ ./csvtest.sh $ ./csvtest.sh
>2 >2 /hledger: Error: input.rules:6:1:
hledger: Error: input.rules:6:1: \|
| 6 \| %amount 150\|acct2
6 | %amount 150|acct2 \| \^
| ^
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
# XXX regex needed for error tests with ghc 9.10, https://gitlab.haskell.org/ghc/ghc/-/issues/25116
# ** 40. unindented condition block error # ** 40. unindented condition block error
< <
@ -796,15 +797,16 @@ if Flubber
account2 acct account2 acct
comment cmt comment cmt
$ ./csvtest.sh $ ./csvtest.sh
>2 >2 /hledger: Error: input.rules:5:1:
hledger: Error: input.rules:5:1: \|
| 5 \| if Flubber
5 | if Flubber \| \^
| ^
start of conditional block found, but no assignment rules afterward 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
# XXX
# ** 41. Assignment to custom field (#1264) + spaces after the if (#1120) # ** 41. Assignment to custom field (#1264) + spaces after the if (#1120)
< <
@ -822,15 +824,16 @@ if Flubber
account2 %myaccount2 account2 %myaccount2
$ ./csvtest.sh $ ./csvtest.sh
>2 >2 /hledger: Error: input.rules:6:3:
hledger: Error: input.rules:6:3: \|
| 6 \| myaccount2 acct
6 | myaccount2 acct \| \^\^\^\^\^\^\^\^\^\^\^\^
| ^^^^^^^^^^^^
unexpected "myaccount2 a" unexpected "myaccount2 a"
expecting conditional block expecting conditional block
/
>=1 >=1
# XXX
# ** 42. Rules override each other in the order listed in the file # ** 42. Rules override each other in the order listed in the file
< <
@ -870,15 +873,16 @@ if account2 comment
%amount 150 acct2 %amount 150 acct2
%description Flubber acct %description Flubber acct
$ ./csvtest.sh $ ./csvtest.sh
>2 >2 /hledger: Error: input.rules:5:1:
hledger: Error: input.rules:5:1: \|
| 5 \| if account2 comment
5 | if account2 comment \| \^
| ^
start of conditional block found, but no assignment rules afterward 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
# XXX
# ** 44. handle conditions with & operator # ** 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 # ** 9. Parse error in malformed forecast period expression
$ hledger bal -M -b 2016-10 -e 2017-02 -f - --forecast=20160801-foobar $ hledger bal -M -b 2016-10 -e 2017-02 -f - --forecast=20160801-foobar
> >
>2 >2 /hledger: Error: could not parse forecast period : 1:10:
hledger: Error: could not parse forecast period : 1:10: \|
| 1 \| 20160801-foobar
1 | 20160801-foobar \| \^
| ^
unexpected 'f' unexpected 'f'
expecting end of input expecting end of input
(use -h to see usage) \(use -h to see usage\)
/
>=1 >=1
# XXX regex needed for error tests with ghc 9.10, https://gitlab.haskell.org/ghc/ghc/-/issues/25116
< <
commodity 1,000.00 USD commodity 1,000.00 USD

View File

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

View File

@ -6,15 +6,16 @@
2018 2018
$ hledger -f - print $ hledger -f - print
>2 >2 /hledger: Error: -:1:5:
hledger: Error: -:1:5: \|
| 1 \| 2018
1 | 2018 \| \^
| ^
unexpected newline unexpected newline
expecting date separator or digit expecting date separator or digit
/
>=1 >=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. # A journal with an unbalanced transaction.
< <
@ -122,18 +123,17 @@ $ hledger -f- print
b 1B b 1B
$ hledger -f- print $ hledger -f- print
>2 >2 /hledger: Error: -:1-3:
hledger: Error: -:1-3: 1 \| 2020-01-01
1 | 2020-01-01 \| a 1A
| a 1A \| b 1B
| b 1B
This multi-commodity transaction is unbalanced. This multi-commodity transaction is unbalanced.
The real postings all have the same sign. Consider negating some of them. 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 >=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. # ** 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. # ** 9. Having parentheses directly follow 'not' sees 'not' as part of a query.
$ hledger -f - print expr:"not(tag:transactiontag=B)" $ hledger -f - print expr:"not(tag:transactiontag=B)"
>2 >2 /hledger: Error: This regular expression is invalid or unsupported, please correct it:
hledger: Error: This regular expression is invalid or unsupported, please correct it: not\(tag:transactiontag=B
not(tag:transactiontag=B /
>=1 >=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. # ** 10. ... whereas parentheses with a space between 'not' and '(' is fine.
$ hledger -f - print expr:"not (tag:transactiontag=B)" $ hledger -f - print expr:"not (tag:transactiontag=B)"

View File

@ -236,10 +236,7 @@ $ hledger -f- roi -p 2019-11
Assets:Checking 101 A Assets:Checking 101 A
Unrealized PnL Unrealized PnL
$ hledger -f- roi -p 2019-11 --inv Investment --pnl PnL $ hledger -f- roi -p 2019-11 --inv Investment --pnl PnL
>2 >2 /hledger: Error: Amounts could not be converted to a single commodity: \["10 B","-9 B @@ 100 A","100 C"\]/
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.
>= 1 >= 1
# ** 10. Forcing valuation via --value # ** 10. Forcing valuation via --value