summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/baseline/opt-account.test4
-rw-r--r--test/baseline/opt-code-as-account.test20
-rw-r--r--test/baseline/opt-commodity-as-account.test4
-rw-r--r--test/baseline/opt-payee-as-account.test20
-rw-r--r--test/baseline/opt-pricedb-format.test2
-rw-r--r--test/baseline/opt-prices-format.test2
-rw-r--r--test/baseline/opt-unrealized-gains.test20
-rw-r--r--test/baseline/opt-unrealized-losses.test20
-rw-r--r--test/baseline/opt-unrealized.test28
-rw-r--r--test/baseline/test-sample.dat91
-rwxr-xr-xtest/convert.py2
-rw-r--r--test/input/sample.dat34
-rw-r--r--test/manual/transaction-codes-2.test4
-rw-r--r--test/manual/transaction-notes-4.test4
-rw-r--r--test/regress/25A099C9.test12
-rw-r--r--test/regress/D943AE0F.test2
16 files changed, 223 insertions, 46 deletions
diff --git a/test/baseline/opt-account.test b/test/baseline/opt-account.test
index 7cda3c4d..10176fde 100644
--- a/test/baseline/opt-account.test
+++ b/test/baseline/opt-account.test
@@ -4,8 +4,8 @@ reg --account='payee + ":" + commodity'
Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
Income:Dividends:Vanguard:VMMXX $-0.35
>>>1
-07-Feb-02 RD VMMXX RD VMMXX:VMMXX 0.350 VMMXX 0.350 VMMXX
-07-Feb-02 RD VMMXX RD VMMXX:$ $-0.35 $-0.35
+07-Feb-02 RD VMMXX RD:VM:As:In:Va:VMMXX 0.350 VMMXX 0.350 VMMXX
+07-Feb-02 RD VMMXX RD:$:In:Di:Va:VMMXX $-0.35 $-0.35
0.350 VMMXX
>>>2
=== 0
diff --git a/test/baseline/opt-code-as-account.test b/test/baseline/opt-code-as-account.test
index c669427e..bb1bf759 100644
--- a/test/baseline/opt-code-as-account.test
+++ b/test/baseline/opt-code-as-account.test
@@ -20,15 +20,15 @@ reg --account=code
Expenses:Books $30.00
Assets:Cash
>>>1
-08-Jan-01 January 100 $10.00 $10.00
-08-Jan-01 January 100 $-10.00 0
-08-Jan-31 End of January 101 $10.00 $10.00
-08-Jan-31 End of January 101 $-10.00 0
-08-Feb-01 February 102 $20.00 $20.00
-08-Feb-01 February 102 $-20.00 0
-08-Feb-28 End of February 103 $20.00 $20.00
-08-Feb-28 End of February 103 $-20.00 0
-08-Mar-01 March $30.00 $30.00
-08-Mar-01 March $-30.00 0
+08-Jan-01 January 100:Expenses:Books $10.00 $10.00
+08-Jan-01 January 100:Assets:Cash $-10.00 0
+08-Jan-31 End of January 101:Expenses:Books $10.00 $10.00
+08-Jan-31 End of January 101:Assets:Cash $-10.00 0
+08-Feb-01 February 102:Expenses:Books $20.00 $20.00
+08-Feb-01 February 102:Assets:Cash $-20.00 0
+08-Feb-28 End of February 103:Expenses:Books $20.00 $20.00
+08-Feb-28 End of February 103:Assets:Cash $-20.00 0
+08-Mar-01 March Expenses:Books $30.00 $30.00
+08-Mar-01 March Assets:Cash $-30.00 0
>>>2
=== 0
diff --git a/test/baseline/opt-commodity-as-account.test b/test/baseline/opt-commodity-as-account.test
index 44fb0028..2e723347 100644
--- a/test/baseline/opt-commodity-as-account.test
+++ b/test/baseline/opt-commodity-as-account.test
@@ -4,8 +4,8 @@ reg --account=commodity
Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
Income:Dividends:Vanguard:VMMXX $-0.35
>>>1
-07-Feb-02 RD VMMXX VMMXX 0.350 VMMXX 0.350 VMMXX
-07-Feb-02 RD VMMXX $ $-0.35 $-0.35
+07-Feb-02 RD VMMXX VM:As:In:Va:VMMXX 0.350 VMMXX 0.350 VMMXX
+07-Feb-02 RD VMMXX $:In:Di:Vanguard:VMMXX $-0.35 $-0.35
0.350 VMMXX
>>>2
=== 0
diff --git a/test/baseline/opt-payee-as-account.test b/test/baseline/opt-payee-as-account.test
index a9c95b2c..6aca0dab 100644
--- a/test/baseline/opt-payee-as-account.test
+++ b/test/baseline/opt-payee-as-account.test
@@ -20,15 +20,15 @@ reg --account=payee
Expenses:Books $30.00
Assets:Cash
>>>1
-08-Jan-01 January January $10.00 $10.00
-08-Jan-01 January January $-10.00 0
-08-Jan-31 End of January End of January $10.00 $10.00
-08-Jan-31 End of January End of January $-10.00 0
-08-Feb-01 February February $20.00 $20.00
-08-Feb-01 February February $-20.00 0
-08-Feb-28 End of February End of February $20.00 $20.00
-08-Feb-28 End of February End of February $-20.00 0
-08-Mar-01 March March $30.00 $30.00
-08-Mar-01 March March $-30.00 0
+08-Jan-01 January January:Expenses:Books $10.00 $10.00
+08-Jan-01 January January:Assets:Cash $-10.00 0
+08-Jan-31 End of January En:Expenses:Books $10.00 $10.00
+08-Jan-31 End of January En:Assets:Cash $-10.00 0
+08-Feb-01 February Fe:Expenses:Books $20.00 $20.00
+08-Feb-01 February February:Assets:Cash $-20.00 0
+08-Feb-28 End of February En:Expenses:Books $20.00 $20.00
+08-Feb-28 End of February En:Assets:Cash $-20.00 0
+08-Mar-01 March March:Expenses:Books $30.00 $30.00
+08-Mar-01 March March:Assets:Cash $-30.00 0
>>>2
=== 0
diff --git a/test/baseline/opt-pricedb-format.test b/test/baseline/opt-pricedb-format.test
index 5dbff609..e2c26f5f 100644
--- a/test/baseline/opt-pricedb-format.test
+++ b/test/baseline/opt-pricedb-format.test
@@ -1,5 +1,7 @@
pricedb --pricedb-format='P %(date) %(scrub(display_amount))\n'
<<<
+D $1,000.00
+
P 2009/01/01 13:30:00 AAPL $10.00
P 2009/01/01 14:30:00 AAPL $20.00
P 2009/01/01 15:30:00 AAPL $30.00
diff --git a/test/baseline/opt-prices-format.test b/test/baseline/opt-prices-format.test
index f8033c59..8a83ad5f 100644
--- a/test/baseline/opt-prices-format.test
+++ b/test/baseline/opt-prices-format.test
@@ -1,5 +1,7 @@
prices --prices-format='%(datetime) %(scrub(display_amount))\n'
<<<
+D $1,000.00
+
P 2009/01/01 13:30:00 AAPL $10.00
P 2009/01/01 14:30:00 AAPL $20.00
P 2009/01/01 15:30:00 AAPL $30.00
diff --git a/test/baseline/opt-unrealized-gains.test b/test/baseline/opt-unrealized-gains.test
new file mode 100644
index 00000000..5b225a42
--- /dev/null
+++ b/test/baseline/opt-unrealized-gains.test
@@ -0,0 +1,20 @@
+bal -V --unrealized --unrealized-gains G
+<<<
+2008/10/01 Sample
+ Assets:Brokerage 10 AAPL
+ Assets:Checking $-200.00
+
+P 2008/10/20 12:00:00 AAPL $30.00
+
+; 2008/10/20 <Generated Transaction>
+; Assets:Brokerage $100
+; Equity:Unrealized Gains
+>>>1
+ $100.00 Assets
+ $300.00 Brokerage
+ $-200.00 Checking
+ $-100.00 G
+--------------------
+ 0
+>>>2
+=== 0
diff --git a/test/baseline/opt-unrealized-losses.test b/test/baseline/opt-unrealized-losses.test
new file mode 100644
index 00000000..2edd4e63
--- /dev/null
+++ b/test/baseline/opt-unrealized-losses.test
@@ -0,0 +1,20 @@
+bal -V --unrealized --unrealized-losses L
+<<<
+2008/10/01 Sample
+ Assets:Brokerage 10 AAPL
+ Assets:Checking $-200.00
+
+P 2008/10/20 12:00:00 AAPL $10.00
+
+; 2008/10/20 <Generated Transaction>
+; Assets:Brokerage $100
+; Equity:Unrealized Gains
+>>>1
+ $-100.00 Assets
+ $100.00 Brokerage
+ $-200.00 Checking
+ $100.00 L
+--------------------
+ 0
+>>>2
+=== 0
diff --git a/test/baseline/opt-unrealized.test b/test/baseline/opt-unrealized.test
index 7d5d20fb..c472d9ef 100644
--- a/test/baseline/opt-unrealized.test
+++ b/test/baseline/opt-unrealized.test
@@ -18,3 +18,31 @@ P 2008/10/20 12:00:00 AAPL $30.00
0
>>>2
=== 0
+bal -V --unrealized --now=2009/11/25
+<<<
+2008/10/01 Sample
+ Assets:Brokerage 10 AAPL
+ Assets:Checking $-200.00
+
+2008/10/01 Sample
+ Assets:Brokerage -10 QQQQ
+ Assets:Checking $1000
+
+P 2008/10/20 12:00:00 AAPL $30.00
+P 2008/10/20 12:00:00 QQQQ $110
+
+; 2008/10/20 <Generated Transaction>
+; Assets:Brokerage $100
+; Equity:Unrealized Gains
+
+; 2008/10/20 <Generated Transaction>
+; Assets:Brokerage $-100
+; Equity:Unrealized Losses
+>>>1
+ 0 Assets
+ $-800.00 Brokerage
+ $800.00 Checking
+--------------------
+ 0
+>>>2
+=== 0
diff --git a/test/baseline/test-sample.dat b/test/baseline/test-sample.dat
new file mode 100644
index 00000000..4bfbe1e2
--- /dev/null
+++ b/test/baseline/test-sample.dat
@@ -0,0 +1,91 @@
+reg
+<<<
+; -*- ledger -*-
+
+N $
+
+= /^Expenses:Books/
+ (Liabilities:Taxes) -0.10
+
+~ Monthly
+ Assets:Bank:Checking $500.00
+ Income:Salary
+
+~ Yearly
+ Expenses:Donations $100.00
+ Assets:Bank:Checking
+
+2004/05/01 * Checking balance
+ Assets:Bank:Checking $1,000.00
+ Equity:Opening Balances
+
+2004/05/03=2004/05/01 * Investment balance
+ Assets:Brokerage 50 AAPL @ $30.00
+ Equity:Opening Balances
+
+2004/05/14 * Páy dày
+ Assets:Bank:Checking 500.00€
+ Income:Salary
+
+2004/05/14 * Another dày in which there is Páying
+ Asséts:Bánk:Chécking:Asséts:Bánk:Chécking $500.00
+ Income:Salary
+
+2004/05/14 * Another dày in which there is Páying
+ Русский язык:Активы:Русский язык:Русский язык $1000.00
+ Income:Salary
+
+tag foo
+
+2004/05/27 Book Store
+ Expenses:Books $20.00
+ Expenses:Cards $40.00
+ Expenses:Docs $30.00
+ Liabilities:MasterCard
+
+end tag
+
+2004/05/27 (100) Credit card company
+ ; This is an xact note!
+ ; Sample: Value
+ Liabilities:MasterCard $20.00
+ ; This is a posting note!
+ ; Sample: Another Value
+ ; :MyTag:
+ Assets:Bank:Checking
+ ; :AnotherTag:
+>>>1
+04-May-01 Checking balance Assets:Bank:Checking $1,000.00 $1,000.00
+ Eq:Opening Balances $-1,000.00 0
+04-May-03 Investment balance Assets:Brokerage 50 AAPL 50 AAPL
+ Eq:Opening Balances $-1,500.00 $-1,500.00
+ 50 AAPL
+04-May-14 Páy dày Assets:Bank:Checking 500.00€ $-1,500.00
+ 50 AAPL
+ 500.00€
+ Income:Salary -500.00€ $-1,500.00
+ 50 AAPL
+04-May-14 Another dày in whic.. ..Bá:Ch:As:Bá:Chécking $500.00 $-1,000.00
+ 50 AAPL
+ Income:Salary $-500.00 $-1,500.00
+ 50 AAPL
+04-May-14 Another dày in whic.. Ру:Ак:Ру:Русский язык $1,000.00 $-500.00
+ 50 AAPL
+ Income:Salary $-1,000.00 $-1,500.00
+ 50 AAPL
+04-May-27 Book Store Expenses:Books $20.00 $-1,480.00
+ 50 AAPL
+ Expenses:Cards $40.00 $-1,440.00
+ 50 AAPL
+ Expenses:Docs $30.00 $-1,410.00
+ 50 AAPL
+ Liabilities:MasterCard $-90.00 $-1,500.00
+ 50 AAPL
+ (Liabilities:Taxes) $-2.00 $-1,502.00
+ 50 AAPL
+04-May-27 Credit card company Liabilities:MasterCard $20.00 $-1,482.00
+ 50 AAPL
+ Assets:Bank:Checking $-20.00 $-1,502.00
+ 50 AAPL
+>>>2
+=== 0
diff --git a/test/convert.py b/test/convert.py
index 0c64fde4..05a62b7e 100755
--- a/test/convert.py
+++ b/test/convert.py
@@ -158,6 +158,8 @@ for line in fd.readlines():
line = re.sub('false', 'False', line)
line = re.sub('CURRENT_TIME\(\)', 'datetime.now()', line)
line = re.sub('CURRENT_DATE\(\)', 'date.today()', line)
+ line = re.sub('commodity\(\)', 'commodity', line)
+ line = re.sub('precision\(\)', 'precision', line)
line = re.sub('([0-9]+)[FL]', '\\1', line)
line = re.sub('([0-9]+)UL', '\\1L', line)
line = re.sub(';', '', line)
diff --git a/test/input/sample.dat b/test/input/sample.dat
index 002d20ee..12ac4cb4 100644
--- a/test/input/sample.dat
+++ b/test/input/sample.dat
@@ -1,42 +1,52 @@
+; -*- ledger -*-
+
N $
-= account =~ /^Expenses:Books/
- (Liabilities:Taxes) -0.10
+= /^Expenses:Books/
+ (Liabilities:Taxes) -0.10
~ Monthly
- Assets:Bank:Checking $500.00
+ Assets:Bank:Checking $500.00
Income:Salary
+~ Yearly
+ Expenses:Donations $100.00
+ Assets:Bank:Checking
+
2004/05/01 * Checking balance
- Assets:Bank:Checking $1,000.00
+ Assets:Bank:Checking $1,000.00
Equity:Opening Balances
2004/05/03=2004/05/01 * Investment balance
- Assets:Brokerage 50 AAPL @ $30.00
+ Assets:Brokerage 50 AAPL @ $30.00
Equity:Opening Balances
2004/05/14 * Páy dày
- Assets:Bank:Checking 500.00€
+ Assets:Bank:Checking 500.00€
Income:Salary
2004/05/14 * Another dày in which there is Páying
- Asséts:Bánk:Chécking:Asséts:Bánk:Chécking $500.00
+ Asséts:Bánk:Chécking:Asséts:Bánk:Chécking $500.00
Income:Salary
2004/05/14 * Another dày in which there is Páying
- Русский язык:Русский язык:Русский язык:Русский язык $1000.00
+ Русский язык:Активы:Русский язык:Русский язык $1000.00
Income:Salary
+tag foo
+
2004/05/27 Book Store
- Expenses:Books $20.00
- Expenses:Cards $40.00
- Expenses:Docs $30.00
+ Expenses:Books $20.00
+ Expenses:Cards $40.00
+ Expenses:Docs $30.00
Liabilities:MasterCard
+end tag
+
2004/05/27 (100) Credit card company
; This is an xact note!
; Sample: Value
- Liabilities:MasterCard $20.00
+ Liabilities:MasterCard $20.00
; This is a posting note!
; Sample: Another Value
; :MyTag:
diff --git a/test/manual/transaction-codes-2.test b/test/manual/transaction-codes-2.test
index 140044d3..1e84b25b 100644
--- a/test/manual/transaction-codes-2.test
+++ b/test/manual/transaction-codes-2.test
@@ -16,8 +16,8 @@ bal checking --account=code
Expenses:Food $4.50
Liabilities:Credit Card
>>>1
- $20.00 DEP
- $-9.00 XFER
+ $20.00 DEP:Assets:Checking
+ $-9.00 XFER:Assets:Checking
--------------------
$11.00
>>>2
diff --git a/test/manual/transaction-notes-4.test b/test/manual/transaction-notes-4.test
index 3dd82677..080c7502 100644
--- a/test/manual/transaction-notes-4.test
+++ b/test/manual/transaction-notes-4.test
@@ -19,8 +19,8 @@ bal food and tag type --account='"Tags:" + tag("Type")'
Assets:Checking
>>>1
$9.00 Tags
- $4.50 Coffee
- $4.50 Dining
+ $4.50 Coffee:Expenses:Food
+ $4.50 Dining:Expenses:Food
--------------------
$9.00
>>>2
diff --git a/test/regress/25A099C9.test b/test/regress/25A099C9.test
index 604939d8..4067d005 100644
--- a/test/regress/25A099C9.test
+++ b/test/regress/25A099C9.test
@@ -4,16 +4,16 @@
>>>2
While parsing file "$sourcepath/src/amount.h", line 67:
Error: No quantity specified for amount
-While parsing file "$sourcepath/src/amount.h", line 721:
+While parsing file "$sourcepath/src/amount.h", line 720:
Error: Invalid date/time: line amount_t amoun
-While parsing file "$sourcepath/src/amount.h", line 727:
+While parsing file "$sourcepath/src/amount.h", line 726:
Error: Invalid date/time: line string amount_
-While parsing file "$sourcepath/src/amount.h", line 733:
+While parsing file "$sourcepath/src/amount.h", line 732:
Error: Invalid date/time: line string amount_
-While parsing file "$sourcepath/src/amount.h", line 739:
+While parsing file "$sourcepath/src/amount.h", line 738:
Error: Invalid date/time: line string amount_
-While parsing file "$sourcepath/src/amount.h", line 745:
+While parsing file "$sourcepath/src/amount.h", line 744:
Error: Invalid date/time: line std::ostream&
-While parsing file "$sourcepath/src/amount.h", line 752:
+While parsing file "$sourcepath/src/amount.h", line 751:
Error: Invalid date/time: line std::istream&
=== 7
diff --git a/test/regress/D943AE0F.test b/test/regress/D943AE0F.test
index 3e568db6..94a26df5 100644
--- a/test/regress/D943AE0F.test
+++ b/test/regress/D943AE0F.test
@@ -1,5 +1,7 @@
reg -V --end=2009/06/16
<<<
+D 1000.00 EUR
+
2008/04/15 * Paid expenses back from cie.
Expenses:Cie-Reimbursements 2000 CAD @ 1.10 EUR
Assets:Checking