diff --git a/tests/journal/market-prices.test b/tests/journal/market-prices.test index 417b543b3..415889279 100644 --- a/tests/journal/market-prices.test +++ b/tests/journal/market-prices.test @@ -2,50 +2,49 @@ # http://hledger.org/hledger.html#market-value # 1. Market prices are ignored by -B. -hledger -f- bal -NB -<<< +< P 2011/01/01 € $1.35 2011/01/01 expenses:foreign €100 assets ->>> + +$ hledger -f- bal -NB €-100 assets €100 expenses:foreign ->>>=0 + # 2. Market prices are used by bal -V. # Market prices for other commodities are not used. # Nor are transaction prices. -hledger -f- bal -N -V -<<< +< P 2011/01/01 € $1.35 P 2011/01/01 GBP $1.35 2011/01/01 (expenses:foreign) €100 @ $1.20 ->>> + +$ hledger -f- bal -N -V $135.00 expenses:foreign ->>>=0 + # 3. Market prices in the future (later than today's date) are always ignored. #453, #683 # XXX not working right now -hledger -f- bal -N -V -<<< +< P 2000/1/1 $ €1.20 P 3000/1/1 $ €1.30 3000/01/01 (a) $100 ->>> + +$ hledger -f- bal -N -V €120.00 a ->>>=0 + # 4. The market prices in effect at the report end date are used. # The location of price directives does not matter. # If multiple directives have the same date, the last parsed is used. -hledger -f- bal -N -V a -e 3000/2 -<<< +< P 3000/3/1 $ €1.40 3000/01/01 @@ -57,27 +56,26 @@ P 3000/3/1 $ €1.40 P 2000/1/1 $ €1.20 P 3000/1/1 $ €1.35 P 3000/1/1 $ €1.30 ->>> + +$ hledger -f- bal -N -V a -e 3000/2 €130.00 a ->>>=0 + # 5. Again, this time there are prices later than the journal data and # an explicit report end date brings them into play. -hledger -f- bal -N -V a -e 3000/2 -<<< +< P 3000/1/1 $ €1.10 P 3000/2/1 $ €1.30 3000/01/01 (a) $100 ->>> +$ hledger -f- bal -N -V a -e 3000/2 €130.00 a ->>>=0 + # 6. Market prices interact with D directives and with amount style canonicalisation. #131 -hledger -f- balance -V -<<< +< D 1000.00 H ; declare a default commodity named H @@ -90,31 +88,32 @@ P 2015/08/14 GGGG 32.39 a 0.3350 FFFF @@ 25 a 0.7718 GGGG @@ 25 b ; implicit balancing amount is in the cost commodity, H ->>> + +$ hledger -f- balance -V 150.48 H a -150.00 H b -------------------- 0.48 H ->>>=0 + # 7. register: -V affects posting amounts and total. -hledger -f- reg -V -<<< +< P 2000/1/1 $ €1.20 2000/1/1 (a) $100 ->>> -2000/01/01 (a) €120.00 €120.00 ->>>=0 -# 8. print: -V affects posting amounts but not balance assertion amounts. -hledger -f- print -V -<<< +$ hledger -f- reg -V +2000/01/01 (a) €120.00 €120.00 + + +# 8. print: -V affects posting amounts but not balance assertions. +< P 2000/1/1 $ €1.20 2000/1/1 (a) $100 = $100 ->>> + +$ hledger -f- print -V 2000/01/01 (a) €120.00 = $100 ->>>=0 +>=0