From 5083255ed33ce2470fceb80346be70fb8c466a99 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 15 Apr 2010 22:59:22 +0000 Subject: [PATCH] pricing, print tests --- tests/pricing.tests | 51 +++++++++++++++++++++++++++++++++++ tests/print-acct-pattern.test | 7 +++++ tests/print-desc-pattern.test | 15 +++++++++++ 3 files changed, 73 insertions(+) create mode 100644 tests/pricing.tests create mode 100644 tests/print-acct-pattern.test create mode 100644 tests/print-desc-pattern.test diff --git a/tests/pricing.tests b/tests/pricing.tests new file mode 100644 index 000000000..74f92025e --- /dev/null +++ b/tests/pricing.tests @@ -0,0 +1,51 @@ +# draft pricing tests +# 1. print a transaction with explicitly-priced amount +./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 +./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 +./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 +./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/print-acct-pattern.test b/tests/print-acct-pattern.test new file mode 100644 index 000000000..189dc620d --- /dev/null +++ b/tests/print-acct-pattern.test @@ -0,0 +1,7 @@ +# print with negative account pattern should exclude transactions containing a matched posting +hledger -f- print not:a +<<< +2010/1/1 x + a 1 + b -1 +>>> diff --git a/tests/print-desc-pattern.test b/tests/print-desc-pattern.test new file mode 100644 index 000000000..386b0af0f --- /dev/null +++ b/tests/print-desc-pattern.test @@ -0,0 +1,15 @@ +./hledger -f - print desc:x +<<< +2009/1/1 x + a 1 + b + +2009/1/1 y + a 1 + b + +>>> +2009/01/01 x + a 1 + b -1 +