summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/python/JournalTest.py18
-rw-r--r--test/regress/1127.test15
-rw-r--r--test/regress/1187_5.test36
-rw-r--r--test/regress/1626.test28
-rw-r--r--test/regress/1703.test11
-rw-r--r--test/regress/7F3650FD.test2
-rw-r--r--test/regress/BBFA1759.test2
-rw-r--r--test/regress/fix-missing-trans-in-last-budget-period.test79
8 files changed, 189 insertions, 2 deletions
diff --git a/test/python/JournalTest.py b/test/python/JournalTest.py
index e65c671d..2565ede8 100644
--- a/test/python/JournalTest.py
+++ b/test/python/JournalTest.py
@@ -22,6 +22,24 @@ class JournalTestCase(unittest.TestCase):
for post in journal.query("food"):
self.assertEqual(str(post.account), "Expenses:Food")
self.assertEqual(post.amount, Amount("$21.34"))
+
+ def testParseError(self):
+ # TODO: ledger spits out parse errors to standard out.
+ # This should not happen, especially when the error
+ # has already been captured by a Python exception.
+ def fun():
+ read_journal_from_string("""
+2012-03-01 KFC
+ Expenses:Food rsnetnirsnti
+ Assets:Cash
+""")
+ self.assertRaises(RuntimeError, fun)
+ try:
+ fun()
+ except RuntimeError as e:
+ self.assertEquals(str(e).splitlines()[-1],
+ "No quantity specified for amount")
+
def suite():
return unittest.TestLoader().loadTestsFromTestCase(JournalTestCase)
diff --git a/test/regress/1127.test b/test/regress/1127.test
new file mode 100644
index 00000000..905401f8
--- /dev/null
+++ b/test/regress/1127.test
@@ -0,0 +1,15 @@
+; Test that automated transactions are added to accounts soon enough
+; for assertions to work.
+
+= expr account =~ /^Assets/
+ (Foo) 1
+
+2018-06-09 Something
+ Assets $100
+ Equity
+
+2018-06-09 Assert amount added by automated transaction
+ [Foo] = $100
+test bal Foo
+ $100 Foo
+end test
diff --git a/test/regress/1187_5.test b/test/regress/1187_5.test
new file mode 100644
index 00000000..4aa5fdd8
--- /dev/null
+++ b/test/regress/1187_5.test
@@ -0,0 +1,36 @@
+2013/12/01 * Initial State
+ Crédit:Viseca:MasterCard P1 -618.50 CHF
+ Crédit:Viseca:MasterCard P2 -52.10 CHF
+ Equity:Opening Balances
+
+2013/12/15 * Buy Some Chocolate
+ Dépenses:Nourriture 19.00 EUR ; #1
+ Crédit:Viseca:MasterCard P1
+
+2013/12/15 * Buy Some Chocolate
+ Crédit:Viseca:MasterCard P1 18.00 EUR ; #2
+ Recettes:Erreurs
+
+2013/12/23 * Facture Viseca
+ Crédit:Viseca:MasterCard P2 52.10 CHF = 0 ; #3
+ Crédit:Viseca:MasterCard P1 618.50 CHF = 0 CHF ; #4
+ Dépenses:Frais:Gestion Comptes 1.50 CHF
+ Crédit:Viseca -672.10 CHF
+
+2014/01/03 * Facture Viseca
+ Crédit:Viseca 672.10 CHF = 0
+ Actif:Comptes:CP courant
+
+test bal
+ -672.10 CHF Actif:Comptes:CP courant
+ -1.00 EUR Crédit:Viseca
+ -1.00 EUR MasterCard P1
+ 1.50 CHF
+ 19.00 EUR Dépenses
+ 1.50 CHF Frais:Gestion Comptes
+ 19.00 EUR Nourriture
+ 670.60 CHF Equity:Opening Balances
+ -18.00 EUR Recettes:Erreurs
+--------------------
+ 0
+end test
diff --git a/test/regress/1626.test b/test/regress/1626.test
new file mode 100644
index 00000000..89ae80f8
--- /dev/null
+++ b/test/regress/1626.test
@@ -0,0 +1,28 @@
+test period every 1000 years from 1 Sep 2011 to 30 May 2012 --now=2018-06-10
+--- Period expression tokens ---
+TOK_EVERY: every
+TOK_INT: 1000
+TOK_YEARS: years
+TOK_SINCE: since
+TOK_INT: 1
+TOK_A_MONTH: Sep
+TOK_INT: 2011
+TOK_UNTIL: until
+TOK_INT: 30
+TOK_A_MONTH: May
+TOK_INT: 2012
+END_REACHED: <EOF>
+
+--- Before stabilization ---
+ range: from day 1 to day 30
+duration: 1000 years
+
+--- After stabilization ---
+ range: from day 1 to day 30
+ start: 18-Jan-01
+ finish: 18-Jan-30
+duration: 1000 years
+
+--- Sample dates in range (max. 20) ---
+ 1: 18-Jan-01 -- 18-Jan-29
+end test
diff --git a/test/regress/1703.test b/test/regress/1703.test
new file mode 100644
index 00000000..983b79be
--- /dev/null
+++ b/test/regress/1703.test
@@ -0,0 +1,11 @@
+
+P 2018-10-31 MultifundosPlus R$0
+
+2017-05-03 * Test
+ Assets:A 1 AAA @ R$ 3000
+ Assets:B
+
+test reg assets:a -V --now 2018-12-31
+17-May-03 Test Assets:A R$3000 R$3000
+end test
+
diff --git a/test/regress/7F3650FD.test b/test/regress/7F3650FD.test
index f0498ddb..0ccfe644 100644
--- a/test/regress/7F3650FD.test
+++ b/test/regress/7F3650FD.test
@@ -68,7 +68,7 @@ end test
test period --now=2010/11/01 2009
--- Period expression tokens ---
-TOK_A_YEAR: 2009
+TOK_INT: 2009
END_REACHED: <EOF>
--- Before stabilization ---
diff --git a/test/regress/BBFA1759.test b/test/regress/BBFA1759.test
index 7a402d0c..5df7ecb2 100644
--- a/test/regress/BBFA1759.test
+++ b/test/regress/BBFA1759.test
@@ -2,7 +2,7 @@
test period june 2008
--- Period expression tokens ---
TOK_A_MONTH: Jun
-TOK_A_YEAR: 2008
+TOK_INT: 2008
END_REACHED: <EOF>
--- Before stabilization ---
diff --git a/test/regress/fix-missing-trans-in-last-budget-period.test b/test/regress/fix-missing-trans-in-last-budget-period.test
new file mode 100644
index 00000000..163a0540
--- /dev/null
+++ b/test/regress/fix-missing-trans-in-last-budget-period.test
@@ -0,0 +1,79 @@
+= ~ ^A
+ [Balance] 1
+ [Budget:$account] -1
+
+~ Monthly from 2014/01 to 2014/12/31
+ [Budget:A] 100.00 USD
+ [Balance]
+
+~ Monthly from 2014/01 to 2014/12/31
+ [Budget:Z] 100.00 USD
+ [Balance]
+
+2014/10/01 toto0
+ [Budget:A:B] 0.01 USD
+ [Balance]
+
+2014/11/01 toto1
+ A:B 51.00 USD
+ Cash
+
+2014/11/02 toto2
+ A:B 52.00 USD
+ Cash
+
+2014/11/03 toto3
+ A:B 53.00 USD
+ Cash
+
+2014/11/04 toto4
+ A:B 54.00 USD
+ Cash
+
+2014/12/08 toto5
+ A:B 55.00 USD
+ Cash
+
+2014/12/09 toto6
+ A:B 56.00 USD
+ Cash
+
+2014/12/10 toto7
+ A:B 57.00 USD
+ Cash
+
+2014/12/11 toto8
+ A:B 58.00 USD
+ Cash
+
+2014/12/12 toto9
+ A:B 59.00 USD
+ Cash
+
+2014/12/12 toto9
+ C 59.00 USD
+ Cash
+
+2015/01/12 toto10
+ A:B 59.00 USD
+ Cash
+
+test reg --budget -b 2014/10 -e 2015/02 --columns 80 --date-format "%F" reg ^Bu
+2014-10-01 Budget transaction [Budget:A] -100.00 USD -100.00 USD
+2014-10-01 Budget transaction [Budget:Z] -100.00 USD -200.00 USD
+2014-10-01 toto0 [Budget:A] 0.01 USD -199.99 USD
+2014-11-01 Budget transaction [Budget:A] -100.00 USD -299.99 USD
+2014-11-01 Budget transaction [Budget:Z] -100.00 USD -399.99 USD
+2014-11-01 toto1 [Budget:A] -51.00 USD -450.99 USD
+2014-11-02 toto2 [Budget:A] -52.00 USD -502.99 USD
+2014-11-03 toto3 [Budget:A] -53.00 USD -555.99 USD
+2014-11-04 toto4 [Budget:A] -54.00 USD -609.99 USD
+2014-12-01 Budget transaction [Budget:A] -100.00 USD -709.99 USD
+2014-12-01 Budget transaction [Budget:Z] -100.00 USD -809.99 USD
+2014-12-08 toto5 [Budget:A] -55.00 USD -864.99 USD
+2014-12-09 toto6 [Budget:A] -56.00 USD -920.99 USD
+2014-12-10 toto7 [Budget:A] -57.00 USD -977.99 USD
+2014-12-11 toto8 [Budget:A] -58.00 USD -1035.99 USD
+2014-12-12 toto9 [Budget:A] -59.00 USD -1094.99 USD
+2015-01-12 toto10 [Budget:A] -59.00 USD -1153.99 USD
+end test