test: more detailed commodity directive tests
This commit is contained in:
parent
cea8bc0558
commit
db45b13249
@ -1,13 +1,73 @@
|
|||||||
# commodity directive
|
# commodity directive
|
||||||
<
|
|
||||||
commodity BTC
|
|
||||||
$ hledger -f - reg
|
|
||||||
|
|
||||||
# commodity directive with subdirective
|
# 1 requires an argument
|
||||||
<
|
<
|
||||||
commodity BTC
|
commodity
|
||||||
note Bitcoin
|
$ hledger -f - commodities
|
||||||
$ hledger -f - reg
|
>2 /unexpected newline/
|
||||||
>2 /expecting "format"/
|
|
||||||
>=1
|
>=1
|
||||||
|
|
||||||
|
# 2 should require an amount, not just a symbol (but doesn't, TODO)
|
||||||
|
<
|
||||||
|
commodity A
|
||||||
|
$ hledger -f - commodities
|
||||||
|
A
|
||||||
|
|
||||||
|
# 3 when there is an amount, a decimal mark is required
|
||||||
|
<
|
||||||
|
commodity A 1
|
||||||
|
$ hledger -f - commodities
|
||||||
|
>2 /Please include a decimal point or decimal comma/
|
||||||
|
>=1
|
||||||
|
|
||||||
|
# 4
|
||||||
|
<
|
||||||
|
commodity A 1.
|
||||||
|
$ hledger -f - commodities
|
||||||
|
A
|
||||||
|
|
||||||
|
# 5
|
||||||
|
<
|
||||||
|
commodity A 1,00
|
||||||
|
$ hledger -f - commodities
|
||||||
|
A
|
||||||
|
|
||||||
|
# 6 accepts a format subdirective
|
||||||
|
<
|
||||||
|
commodity A
|
||||||
|
format 1.0 A
|
||||||
|
$ hledger -f - commodities
|
||||||
|
A
|
||||||
|
|
||||||
|
# 7 which also requires an amount argument
|
||||||
|
<
|
||||||
|
commodity A
|
||||||
|
format
|
||||||
|
$ hledger -f - commodities
|
||||||
|
>2 /expecting amount/
|
||||||
|
>=1
|
||||||
|
|
||||||
|
# 8 which must have the same commodity symbol
|
||||||
|
<
|
||||||
|
commodity A
|
||||||
|
format 1
|
||||||
|
$ hledger -f - commodities
|
||||||
|
>2 /commodity directive symbol .* and format directive symbol .* should be the same/
|
||||||
|
>=1
|
||||||
|
|
||||||
|
# 9 when there's a format subdirective, the main directive should have just a symbol
|
||||||
|
# (and the error message should be clear, TODO)
|
||||||
|
<
|
||||||
|
commodity A 1.
|
||||||
|
format 1. A
|
||||||
|
$ hledger -f - commodities
|
||||||
|
>2 /unexpected 'f'/
|
||||||
|
>=1
|
||||||
|
|
||||||
|
# 10 it rejects unrecognised subdirectives (should be permissive like account, TODO)
|
||||||
|
<
|
||||||
|
commodity A
|
||||||
|
note a a
|
||||||
|
$ hledger -f - commodities
|
||||||
|
>2 /expecting "format"/
|
||||||
|
>=1
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user