diff --git a/tests/amount-layout-vertical.test b/tests/amount-layout-vertical.test index 9e19693a1..f5d87e6d6 100644 --- a/tests/amount-layout-vertical.test +++ b/tests/amount-layout-vertical.test @@ -1,4 +1,5 @@ -# test mixed amount layout with various commands +# amount layout tests, using default vertical layout +# 1. print bin/hledger -f - print <<< 2010/1/1 @@ -12,7 +13,7 @@ bin/hledger -f - print EUR -1 c USD -1 ; a euro and a dollar -# +# 2. register bin/hledger -f - register <<< 2010/1/1 @@ -25,7 +26,7 @@ bin/hledger -f - register b USD 1 USD 1 EUR -1 c USD -1 0 -# +# 3. balance bin/hledger -f - balance <<< 2010/1/1 @@ -39,3 +40,51 @@ bin/hledger -f - balance USD -1 c -------------------- EUR 0 +# 4. mixed amounts with prices +# XXX +# bin/hledger -f - print +# <<< +# 2010/1/1 +# a EUR 1 @ USD 1.1 ; a euro +# b USD 1 ; a dollar +# c ; a euro and a dollar +# >>> +# 2010/01/01 +# a EUR 1 @ USD 1.1 ; a euro +# b USD 1 ; a dollar +# EUR -1 @ USD 1.1 +# c USD -1 ; a euro and a dollar +# +## +# 2010/01/01 +# a EUR 1 @ USD 1.1 ; a euro +# b USD 1.0 ; a dollar +# c USD -2.1 ; a euro and a dollar +# +# # +# bin/hledger -f - register +# <<< +# 2010/1/1 +# a EUR 1 @ USD 1.1 ; a euro +# b USD 1 ; a dollar +# c ; a euro and a dollar +# >>> +# 2010/01/01 a EUR 1 EUR 1 +# EUR 1 +# b USD 1.0 USD 1.0 +# EUR 1 +# c USD -2.1 USD -1.1 +# # +# bin/hledger -f - balance +# <<< +# 2010/1/1 +# a EUR 1 @ USD 1.1 ; a euro +# b USD 1 ; a dollar +# c ; a euro and a dollar +# >>> +# EUR 1 a +# USD 1.0 b +# USD -2.1 c +# -------------------- +# EUR 1 +# USD -1.1 diff --git a/tests/amounts.test b/tests/amounts.test deleted file mode 100644 index 1db45cd07..000000000 --- a/tests/amounts.test +++ /dev/null @@ -1,24 +0,0 @@ -# 1. a no-commodity amount with a unit price -bin/hledger -f - print -<<< -2010/1/1 x - a 1 @ $2 - b - ->>> -2010/01/01 x - a 1 @ $2 - b -1 @ $2 - -# 2. with a total price -bin/hledger -f - print -<<< -2010/1/1 x - a 2 @@ $2 - b - ->>> -2010/01/01 x - a 2 @@ $2 - b -2 @@ $2 - diff --git a/tests/price-history.test b/tests/price-history.test deleted file mode 100644 index 7eb05c6ff..000000000 --- a/tests/price-history.test +++ /dev/null @@ -1,14 +0,0 @@ -bin/hledger -f - print -<<< -P 2009/1/1 p 0.5h - -2009/1/1 t - a 1p - b - ->>> -2009/01/01 t - a 1p @ 0.5h - b -1p @ 0.5h - ->>>2 diff --git a/tests/prices.tests b/tests/prices.tests new file mode 100644 index 000000000..b989a5628 --- /dev/null +++ b/tests/prices.tests @@ -0,0 +1,66 @@ +# price-related tests +# 1. print a transaction with an explicit unit price +bin/hledger -f- print +<<< +2011/01/01 + expenses:foreign currency €100 @ $1.35 + assets +>>> +2011/01/01 + expenses:foreign currency €100 @ $1.35 + assets €-100 @ $1.35 + +# 2. convert to cost basis +bin/hledger -f- print -B +<<< +2011/01/01 + expenses:foreign currency €100 @ $1.35 + assets +>>> +2011/01/01 + expenses:foreign currency $135.00 + assets $-135.00 + +# 2. with a historical price directive +bin/hledger -f- print -B +<<< +P 2010/12/31 € $1.34 +P 2011/01/01 € $1.35 +P 2011/01/02 € $1.36 + +2011/01/01 + expenses:foreign currency €100 + assets + +>>> +2011/01/01 + expenses:foreign currency $135.00 + assets $-135.00 + +# 3. with a total price +bin/hledger -f - print +<<< +2011/01/01 + expenses:foreign currency €100 @@ $135 + assets +>>> +2011/01/01 + expenses:foreign currency €100 @@ $135 + assets €-100 @@ $135 + +# 4. with an implicit price +# bin/hledger -f - print +# <<< +# 2011/01/01 +# expenses:foreign currency €100 @ $1.35 +# assets $-135.00 +# >>> +# 2011/01/01 +# expenses:foreign currency €100 @ $1.35 +# assets +# +# 2009/1/1 opening balance +# Assets:Brokerage 1 AAPL +# Assets:Checking $-20.00 +# +# >>>= 0 diff --git a/tests/pricing.tests b/tests/pricing.tests deleted file mode 100644 index 28169a0ce..000000000 --- a/tests/pricing.tests +++ /dev/null @@ -1,51 +0,0 @@ -# draft pricing tests -# 1. print a transaction with explicitly-priced amount -bin/hledger -f- print -<<< -2009/1/2 x - expenses:foreign currency €100 @ $1.35 - assets ->>> -2009/01/02 x - expenses:foreign currency €100 @ $1.35 - assets $-135.00 - -# 2. again, this time converting to cost basis -bin/hledger -f- print -B -<<< -2009/1/2 x - expenses:foreign currency €100 @ $1.35 - assets ->>> -2009/01/02 x - expenses:foreign currency $135.00 - assets $-135.00 - -# 3. same as above, but using a historical price directive -bin/hledger -f- print -<<< -P 2009/1/1 € $1.35 - -2009/1/2 x - expenses:foreign currency €100 - assets - ->>> -2009/01/02 x - expenses:foreign currency €100 @ $1.35 - assets €-100 @ $1.35 - -# 4. and with conversion -bin/hledger -f- print -B -<<< -P 2009/1/1 € $1.35 - -2009/1/2 x - expenses:foreign currency €100 - assets - ->>> -2009/01/02 x - expenses:foreign currency $135.00 - assets $-135.00 - diff --git a/tests/set-price-to-balance.test.unimplemented b/tests/set-price-to-balance.test.unimplemented deleted file mode 100644 index 39d6c9b5c..000000000 --- a/tests/set-price-to-balance.test.unimplemented +++ /dev/null @@ -1,8 +0,0 @@ -# should infer prices to balance this - not implemented -bin/hledger -f - print -<<< -2009/1/1 opening balance - Assets:Brokerage 1 AAPL - Assets:Checking $-20.00 - ->>>= 0