From f58fcd95abd505e69626926c08fe6aa5dc4116b3 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 20 Apr 2021 09:55:11 -1000 Subject: [PATCH] ;journal: tests demonstrating commodity parse errors (#1532) --- .../test/journal/amounts-and-commodities.test | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/hledger/test/journal/amounts-and-commodities.test b/hledger/test/journal/amounts-and-commodities.test index 1301630ce..2fb43b80f 100644 --- a/hledger/test/journal/amounts-and-commodities.test +++ b/hledger/test/journal/amounts-and-commodities.test @@ -210,3 +210,47 @@ $ hledger -f - print (a) A 1.122 = A 1.123 >= + +# Error message when commodity symbols containing non-letters are not quoted. (#1532) + +# 15. Commodity symbol on the left, ending with numbers, could parse successfully +# (as "A 12" since space is a valid separator of digit groups). +< +2021-01-01 + (a) A1 2 + +$ hledger -f- print cur:A amt:12 +2021-01-01 + (a) A1 2 + +>= + +# 16. Commodity symbol on the left, failing to parse - gives this long error message. +< +2021-01-01 + (a) A1B 2 + +$ hledger -f- print cur:A1B amt:2 +>2 /expecting ';', '=', digit, end of input, exponent, ledger-style lot date, ledger-style lot price, newline, space, or transaction price/ +>=1 + +# 17. Commodity symbol on the right, failing to parse - gives this long error message. +< +2021-01-01 + (a) 1 A2 + +$ hledger -f- print cur:A1 amt:2 +>2 /expecting ';', '=', end of input, ledger-style lot date, ledger-style lot price, newline, or transaction price/ +>=1 + +# 18. Commodity symbol on the right, beginning with numbers, could parse successfully. +< +2021-01-01 + (a) 1 2A + +$ hledger -f- print cur:A amt:12 +2021-01-01 + (a) 1 2A + +>= +