;dev: tests: be more robust when testing a "hledger-VER" executable

This commit is contained in:
Simon Michael 2025-05-13 10:48:16 -10:00
parent 87c7f61670
commit 1d150549b2
38 changed files with 44 additions and 44 deletions

View File

@ -774,7 +774,7 @@ if|account2|comment
%amount 150|acct2
%description Flubber|acct|
$ ./csvtest.sh
>2 /hledger: Error: input.rules:6:1:
>2 /Error: input.rules:6:1:
\|
6 \| %amount 150\|acct2
\| \^
@ -796,7 +796,7 @@ if Flubber
account2 acct
comment cmt
$ ./csvtest.sh
>2 /hledger: Error: input.rules:5:1:
>2 /Error: input.rules:5:1:
\|
5 \| if Flubber
\| \^
@ -822,7 +822,7 @@ if Flubber
account2 %myaccount2
$ ./csvtest.sh
>2 /hledger: Error: input.rules:6:3:
>2 /Error: input.rules:6:3:
\|
6 \| myaccount2 acct
\| \^\^\^\^\^\^\^\^\^\^\^\^
@ -870,7 +870,7 @@ if account2 comment
%amount 150 acct2
%description Flubber acct
$ ./csvtest.sh
>2 /hledger: Error: input.rules:5:1:
>2 /Error: input.rules:5:1:
\|
5 \| if account2 comment
\| \^

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
$$$ hledger check balanced -f balanced.j
>>>2 /hledger: Error: .*balanced.j:5-7:
>>>2 /Error: .*balanced.j:5-7:
5 \| 2022-01-01
\| a 1 A
\| b -1 B

View File

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

View File

@ -1,5 +1,5 @@
$$$ hledger check -f csvamountonenonzero.csv
>>>2 /hledger: Error: in CSV rules:
>>>2 /Error: in CSV rules:
While processing CSV record: "2022-01-03","1","2"
while calculating amount for posting 1
rule "amount-in %2" assigned value "1"

View File

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

View File

@ -1,5 +1,5 @@
$$$ hledger check -f csvbalanceparse.csv
>>>2 /hledger: Error: could not parse "badbalance" as balance1 amount
>>>2 /Error: could not parse "badbalance" as balance1 amount
CSV 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 /hledger: Error: balance-type "badtype" is invalid. Use =, ==, =\* or ==\*.
>>>2 /Error: balance-type "badtype" is invalid. Use =, ==, =\* or ==\*.
CSV record: "2022-01-01","1"
the balance rule is: %2
the date rule is: %1

View File

@ -1,5 +1,5 @@
$$$ hledger print -f csvdateformat.csv
>>>2 /hledger: Error: could not parse "a" as a date using date format "YYYY\/M\/D", "YYYY-M-D" or "YYYY.M.D"
>>>2 /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"
the date rule is: %1
the date-format is: unspecified

View File

@ -1,5 +1,5 @@
$$$ hledger check -f csvdateparse.csv
>>>2 /hledger: Error: could not parse "baddate" as a date using date format "%Y-%m-%d"
>>>2 /Error: could not parse "baddate" as a date using date format "%Y-%m-%d"
CSV record: "baddate","b"
the date rule is: %1
the date-format is: %Y-%m-%d

View File

@ -1,5 +1,5 @@
$$$ hledger check -f csvdaterule.csv
>>>2 /hledger: Error: offset=0:
>>>2 /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 /hledger: Error: decimal-mark's argument should be "." or "," \(not "badmark"\)
>>>2 /Error: decimal-mark's argument should be "." or "," \(not "badmark"\)
/
>>>= 1

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
$$$ hledger check -f csvnoinclude.j
>>>2 /hledger: Error: sorry, CSV files can't be included yet
>>>2 /Error: sorry, CSV files can't be included yet
/
>>>= 1

View File

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

View File

@ -1,5 +1,5 @@
$$$ hledger print -f csvstatusparse.csv
>>>2 /hledger: Error: could not parse status value "badstatus" \(should be \*, ! or empty\)
>>>2 /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 /hledger: Error: please use --rules when reading CSV from stdin
>>>2 /Error: please use --rules when reading CSV from stdin
/
>>>= 1

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
$$$ hledger check -f tcclockouttime.timeclock
>>>2 /hledger: Error: .*tcclockouttime.timeclock:5:1:
>>>2 /Error: .*tcclockouttime.timeclock:5:1:
5 \| o 2022-01-01 00:00:00
\| \^

View File

@ -1,5 +1,5 @@
$$$ hledger check -f tcorderedactions.timeclock
>>>2 /hledger: Error: .*tcorderedactions.timeclock:8:1:
>>>2 /Error: .*tcorderedactions.timeclock:8:1:
8 \| i 2022-01-01 00:01:00
\| \^

View File

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

View File

@ -170,7 +170,7 @@ 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:
>2 /Error: could not parse forecast period : 1:10:
\|
1 \| 20160801-foobar
\| \^

View File

@ -73,7 +73,7 @@ Expenses:Food
account (a)
$ hledger -f- accounts
>2 /hledger: Error: -:1:9:
>2 /Error: -:1:9:
\|
1 \| account \(a\)
\| \^
@ -88,7 +88,7 @@ expecting account name without brackets
account [a]
$ hledger -f- accounts
>2 /hledger: Error: -:1:9:
>2 /Error: -:1:9:
\|
1 \| account \[a\]
\| \^

View File

@ -6,7 +6,7 @@
2018
$ hledger -f - print
>2 /hledger: Error: -:1:5:
>2 /Error: -:1:5:
\|
1 \| 2018
\| \^
@ -122,7 +122,7 @@ $ hledger -f- print
b 1B
$ hledger -f- print
>2 /hledger: Error: -:1-3:
>2 /Error: -:1-3:
1 \| 2020-01-01
\| a 1A
\| b 1B

View File

@ -129,7 +129,7 @@ $ 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:
>2 /Error: This regular expression is invalid or unsupported, please correct it:
not\(tag:transactiontag=B
/
>=1

View File

@ -236,7 +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"\]/
>2 /Error: Amounts could not be converted to a single commodity: \["10 B","-9 B @@ 100 A","100 C"\]/
>= 1
# ** 10. Forcing valuation via --value

View File

@ -6,13 +6,13 @@
assets:cash -$100
expenses:food
$ hledger run -f- aregister cash
>2 /hledger: Error: aregister: openFile: does not exist \(No such file or directory\)/
>2 /Error: aregister: openFile: does not exist \(No such file or directory\)/
>=1
# ** 2. Run refuses to read input file and commands from stdin
<
$ hledger run -f-
>2 /hledger: Error: 'run' can't read commands from stdin, as one of the input files was stdin as well/
>2 /Error: 'run' can't read commands from stdin, as one of the input files was stdin as well/
>=1
# ** 3. Run one command from command line