diff options
author | Martin Michlmayr <tbm@cyrius.com> | 2015-07-30 17:44:32 -0400 |
---|---|---|
committer | Martin Michlmayr <tbm@cyrius.com> | 2015-07-30 17:44:32 -0400 |
commit | 4e12580789523afb6c3b582c925eef44fad04488 (patch) | |
tree | 4157f8662facd1cbd2513e9a6d0c5ad6ed0fb4b0 /test/baseline | |
parent | 61995d6a200b2d277c9fe6746be20d07690763c2 (diff) | |
download | fork-ledger-4e12580789523afb6c3b582c925eef44fad04488.tar.gz fork-ledger-4e12580789523afb6c3b582c925eef44fad04488.tar.bz2 fork-ledger-4e12580789523afb6c3b582c925eef44fad04488.zip |
Add test for --value-expr
See John's email "A solution to the commodity pricing problem" on how
this works:
https://groups.google.com/forum/#!topic/ledger-cli/gpOW50XtCTo
Diffstat (limited to 'test/baseline')
-rw-r--r-- | test/baseline/opt-value-expr.test | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/test/baseline/opt-value-expr.test b/test/baseline/opt-value-expr.test index e69de29b..c71be26e 100644 --- a/test/baseline/opt-value-expr.test +++ b/test/baseline/opt-value-expr.test @@ -0,0 +1,48 @@ + +D 1000.00 EUR +D 1000.00 USD +D 1000.00 DM + +2015-01-01 * Buy 2 FOO + Assets:Investments 2 FOO @@ 20.00 EUR + Assets:Cash -20.00 EUR + +2015-05-01 * Buy 2 FOO + Expenses:Food 20.00 USD + ; Just to be silly, always valuate *these* $20 as 30 DM, no matter what + ; the user asks for with -V or -X + ; VALUE:: 30 DM + Assets:Cash -20.00 USD + +P 2015-05-01 USD 20 DM + +P 2015-06-01 USD 22 DM + +test bal assets:investments -V --value-expr "25.00 EUR" + 50.00 EUR Assets:Investments +end test + +test bal assets:investments -G --value-expr "date < [March 2015] ? 22.00 EUR : 25.00 EUR" --now "2015-02-20" + 24.00 EUR Assets:Investments +end test + +test bal assets:investments -G --value-expr "date < [March 2015] ? 22.00 EUR : 25.00 EUR" --now "2015-03-20" + 30.00 EUR Assets:Investments +end test + +test bal expenses:food + 20.00 USD Expenses:Food +end test + +test bal expenses:food -V + 600.00 DM Expenses:Food +end test + +test bal expenses:food -X "DM" --now "2015-05-02" + 600.00 DM Expenses:Food +end test + +test bal expenses:food -X "DM" --now "2015-06-02" + 600.00 DM Expenses:Food +end test + |