parsing: -B/--cost now ignores P historical prices, like ledger

This commit is contained in:
Simon Michael 2012-01-22 20:39:11 +00:00
parent 1bc4d4b395
commit 41c1fa636a
4 changed files with 39 additions and 32 deletions

View File

@ -266,7 +266,6 @@ journalFinalise :: ClockTime -> LocalTime -> FilePath -> String -> JournalContex
journalFinalise tclock tlocal path txt ctx j@Journal{files=fs} = journalFinalise tclock tlocal path txt ctx j@Journal{files=fs} =
journalBalanceTransactions $ journalBalanceTransactions $
journalCanonicaliseAmounts $ journalCanonicaliseAmounts $
journalApplyHistoricalPrices $
journalCloseTimeLogEntries tlocal journalCloseTimeLogEntries tlocal
j{files=(path,txt):fs, filereadtime=tclock, jContext=ctx} j{files=(path,txt):fs, filereadtime=tclock, jContext=ctx}

View File

@ -1,9 +0,0 @@
# 1. this should balance
bin/hledger -f - print
<<<
2011/1/1
a 1h @ $10
b 1h @ $20
c $-30
>>>2 !/could not balance/
>>>= 0

View File

@ -12,7 +12,7 @@ bin/hledger -f- print
>>>=0 >>>=0
# 2. convert to cost # 2. -B/--cost converts to the price's commodity ("cost")
bin/hledger -f- print --cost bin/hledger -f- print --cost
<<< <<<
2011/01/01 2011/01/01
@ -25,12 +25,10 @@ bin/hledger -f- print --cost
>>>=0 >>>=0
# 3. with a historical price directive # 3. -B should ignore historical price directives
bin/hledger -f- print -B bin/hledger -f- print -B
<<< <<<
P 2010/12/31 € $1.34
P 2011/01/01 € $1.35 P 2011/01/01 € $1.35
P 2011/01/02 € $1.36
2011/01/01 2011/01/01
expenses:foreign currency €100 expenses:foreign currency €100
@ -38,12 +36,12 @@ P 2011/01/02 € $1.36
>>> >>>
2011/01/01 2011/01/01
expenses:foreign currency $135.00 expenses:foreign currency €100
assets $-135.00 assets €-100
>>>=0 >>>=0
# 4. with a total price # 4. print a transaction with a total price
bin/hledger -f - print bin/hledger -f - print
<<< <<<
2011/01/01 2011/01/01
@ -184,3 +182,21 @@ bin/hledger -f - balance
-------------------- --------------------
£2 £2
>>>=0 >>>=0
# 14. this should balance
bin/hledger -f - balance
<<<
2011/1/1
a 1h @ $10
b 1h @ $20
c $-30
>>>= 0
# 15. this should balance, ignoring the P
bin/hledger -f - balance
<<<
P 2011/11/15 EUR CHF 1.234
2011/11/19
a EUR 1000.00
b CHF -1254
>>>= 0

View File

@ -1,21 +1,22 @@
# timezone-related tests # timezone-related tests
# 1. as in ledger, historical prices may contain a time and timezone. # 1. as in ledger, historical prices may contain a time and timezone.
# hledger ignores them and uses 00:00 local time instead. # hledger ignores them and uses 00:00 local time instead.
bin/hledger -f - balance --no-total --cost # XXX needs --value not --cost
<<< # bin/hledger -f - balance --no-total --cost
P 2011/01/01 00:00:00 A $1 # <<<
P 2011/01/01 15:00:00-0100 A $2 # P 2011/01/01 00:00:00 A $1
# P 2011/01/01 15:00:00-0100 A $2
2010/12/31 # 2010/12/31
(20101231) 1 A # (20101231) 1 A
2011/1/1 # 2011/1/1
(20110101) 1 A # (20110101) 1 A
2011/1/2 # 2011/1/2
(20110102) 1 A # (20110102) 1 A
>>> # >>>
1 A 20101231 # 1 A 20101231
$2 20110101 # $2 20110101
$2 20110102 # $2 20110102
>>>=0 # >>>=0