Skip to content
Permalink
Browse files

;journal: fix tests

  • Loading branch information
simonmichael committed Mar 18, 2020
1 parent b5c332d commit 84165f5a0c80bbb7f1a5d4a4198f1bb2e380940f
@@ -977,7 +977,7 @@ tests_JournalReader = tests "JournalReader" [

,test "defaultcommoditydirectivep" $ do
assertParse defaultcommoditydirectivep "D $1,000.0\n"
assertParseError defaultcommoditydirectivep "D $1000\n" "please include a decimal separator"
assertParseError defaultcommoditydirectivep "D $1000\n" "Please include a decimal point or decimal comma"

,tests "defaultyeardirectivep" [
test "1000" $ assertParse defaultyeardirectivep "Y 1000" -- XXX no \n like the others
@@ -115,15 +115,15 @@ $ hledger -f- bal -V -N

# TODO #749

# 9. Here the amount is parsed as 1. I think (hope) no country uses space
# 8. Here the amount is parsed as 1. I think (hope) no country uses space
# for decimal point, so we should parse this as 1000.
<
2018-01-01
(a) USD1 000

$ hledger -f- reg amt:1

# 10. This commodity directive should complain about a missing decimal separator,
# 9. This commodity directive should complain about a missing decimal separator,
# which we now require.
<
commodity 1 000 USD
@@ -132,26 +132,26 @@ commodity 1 000 USD
(a) USD1 000

$ hledger -f- bal
>2 /decimal separator/
>2 /decimal point or decimal comma/
>=1

# 11. After a space-grouped amount, a posting comment should parse.
# 10. After a space-grouped amount, a posting comment should parse.
<
2018-01-01
(a) USD 1 000 ;comment

$ hledger -f- print
> // # any stdout, no stderr, 0 exit code

# 12. After a space-grouped amount, trailing whitespace should parse.
# 11. After a space-grouped amount, trailing whitespace should parse.
<
2018-01-01
(a) USD 1 000

$ hledger -f- print
> // # any stdout, no stderr, 0 exit code

# 13. Example of surprising decimal mark parsing behaviour.
# 12. Example of surprising decimal mark parsing behaviour.
# Without a commodity declaration, these amounts are parsed as 10 and 10000.
# <
# 2000/1/1
@@ -162,4 +162,4 @@ $ hledger -f- print
# could not balance this transaction (real postings are off by $9,990,000)
# 2000-01-01
# a $-10,000
# b $10,000,000
# b $10,000,000
@@ -130,7 +130,7 @@ commodity €1,000.00
hledger bal -f -
<<<
commodity 1000 EUR
>>>2 /please include a decimal separator/
>>>2 /Please include a decimal point or decimal comma/
>>>=1

# 12. Commodity directive with zero precision

0 comments on commit 84165f5

Please sign in to comment.
You can’t perform that action at this time.