diff options
author | Martin Michlmayr <tbm@cyrius.com> | 2019-02-05 08:27:25 -0500 |
---|---|---|
committer | Martin Michlmayr <tbm@cyrius.com> | 2019-02-05 08:27:25 -0500 |
commit | 0bbb976ee3064ff59b319e30fd97e31020259760 (patch) | |
tree | 5d13986511c18d911b0d1b2dc498b0f81d3a3b0e /test | |
parent | 9de94d4adb7a566af38814f9d37e26c559b68b4f (diff) | |
parent | 7a5871d3b53e66ee261bea4b41512e99269b18b1 (diff) | |
download | fork-ledger-0bbb976ee3064ff59b319e30fd97e31020259760.tar.gz fork-ledger-0bbb976ee3064ff59b319e30fd97e31020259760.tar.bz2 fork-ledger-0bbb976ee3064ff59b319e30fd97e31020259760.zip |
Merge branch 'next' into release/3.1.2
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 4 | ||||
-rw-r--r-- | test/python/JournalTest.py | 18 | ||||
-rw-r--r-- | test/regress/1127.test | 15 | ||||
-rw-r--r-- | test/regress/1187_5.test | 36 | ||||
-rw-r--r-- | test/regress/1222.test | 7 | ||||
-rw-r--r-- | test/regress/1224.test | 9 | ||||
-rw-r--r-- | test/regress/1626.test | 28 | ||||
-rw-r--r-- | test/regress/1703.test | 11 | ||||
-rw-r--r-- | test/regress/1722.test | 12 | ||||
-rw-r--r-- | test/regress/1723.test | 5 | ||||
-rw-r--r-- | test/regress/25A099C9.dat (renamed from test/garbage-input.dat) | 0 | ||||
-rw-r--r-- | test/regress/25A099C9.test | 60 | ||||
-rw-r--r-- | test/regress/7F3650FD.test | 2 | ||||
-rw-r--r-- | test/regress/BBFA1759.test | 2 | ||||
-rw-r--r-- | test/regress/fix-missing-trans-in-last-budget-period.test | 79 | ||||
-rw-r--r-- | test/unit/CMakeLists.txt | 3 |
16 files changed, 252 insertions, 39 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d0b62f6e..41eecb36 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -27,8 +27,6 @@ macro(add_ledger_harness_tests _class) ${TestFile} ${TEST_PYTHON_FLAGS}) set_tests_properties(${_class}Test_${TestFile_Name} PROPERTIES ENVIRONMENT "TZ=${Ledger_TEST_TIMEZONE}") - set_target_properties(check - PROPERTIES DEPENDS ${_class}Test_${TestFile_Name}) endif() endforeach() endif() @@ -48,8 +46,6 @@ if (PYTHONINTERP_FOUND) --ledger $<TARGET_FILE:ledger> --file ${TestFile}) set_tests_properties(${_class}Test_${TestFile_Name} PROPERTIES ENVIRONMENT "TZ=${Ledger_TEST_TIMEZONE}") - set_target_properties(check - PROPERTIES DEPENDS ${_class}Test_${TestFile_Name}) endforeach() # CheckManpage and CheckTexinfo are disabled, since they do not work 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/1222.test b/test/regress/1222.test new file mode 100644 index 00000000..535a0e32 --- /dev/null +++ b/test/regress/1222.test @@ -0,0 +1,7 @@ +--fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo + +test reg -> 1 +__ERROR__ +While parsing file "$FILE", line 1: +Error: Illegal option --fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo +end test diff --git a/test/regress/1224.test b/test/regress/1224.test new file mode 100644 index 00000000..ecf87228 --- /dev/null +++ b/test/regress/1224.test @@ -0,0 +1,9 @@ +2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + +test reg -> 1 +__ERROR__ +While parsing file "$FILE", line 1: +While parsing transaction: +> 2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Error: Invalid date: 2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +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/1722.test b/test/regress/1722.test new file mode 100644 index 00000000..432a19b2 --- /dev/null +++ b/test/regress/1722.test @@ -0,0 +1,12 @@ + +2003/12/20 Organic Co-op + Expenses:Food:Groceries $ 37.50 ; ] [=2004/01/01] + Assets:Cash $-37.50 + +test bal + $ -37.50 Assets:Cash + $ 37.50 Expenses:Food:Groceries +-------------------- + 0 +end test + diff --git a/test/regress/1723.test b/test/regress/1723.test new file mode 100644 index 00000000..62a50386 --- /dev/null +++ b/test/regress/1723.test @@ -0,0 +1,5 @@ +2017/3/17 deferred posting + <deferred posting> + +test reg +end test diff --git a/test/garbage-input.dat b/test/regress/25A099C9.dat index 1b7d2101..1b7d2101 100644 --- a/test/garbage-input.dat +++ b/test/regress/25A099C9.dat diff --git a/test/regress/25A099C9.test b/test/regress/25A099C9.test index cfc0eabd..36776520 100644 --- a/test/regress/25A099C9.test +++ b/test/regress/25A099C9.test @@ -1,61 +1,61 @@ -test -f test/garbage-input.dat reg -> 29 +test -f test/regress/25A099C9.dat reg -> 29 __ERROR__ -While parsing file "$sourcepath/test/garbage-input.dat", line 1: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 1: Error: Directive '/*' requires an argument -While parsing file "$sourcepath/test/garbage-input.dat", line 32: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 32: Error: Directive '/**' requires an argument -While parsing file "$sourcepath/test/garbage-input.dat", line 36: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 36: Error: Directive '/**' requires an argument -While parsing file "$sourcepath/test/garbage-input.dat", line 66: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 66: Error: No quantity specified for amount -While parsing file "$sourcepath/test/garbage-input.dat", line 69: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 69: Error: Unexpected whitespace at beginning of line -While parsing file "$sourcepath/test/garbage-input.dat", line 78: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 78: Error: Directive '};' requires an argument -While parsing file "$sourcepath/test/garbage-input.dat", line 82: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 82: Error: Directive '/**' requires an argument -While parsing file "$sourcepath/test/garbage-input.dat", line 93: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 93: Error: Unexpected whitespace at beginning of line -While parsing file "$sourcepath/test/garbage-input.dat", line 97: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 97: Error: Directive '{' requires an argument -While parsing file "$sourcepath/test/garbage-input.dat", line 98: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 98: Error: Directive 'public:' requires an argument -While parsing file "$sourcepath/test/garbage-input.dat", line 120: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 120: Error: Directive 'protected:' requires an argument -While parsing file "$sourcepath/test/garbage-input.dat", line 131: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 131: Error: Directive 'public:' requires an argument -While parsing file "$sourcepath/test/garbage-input.dat", line 711: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 711: Error: Unexpected whitespace at beginning of line -While parsing file "$sourcepath/test/garbage-input.dat", line 740: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 740: Error: Directive 'private:' requires an argument -While parsing file "$sourcepath/test/garbage-input.dat", line 749: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 749: Error: Unexpected whitespace at beginning of line -While parsing file "$sourcepath/test/garbage-input.dat", line 750: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 750: Error: Directive '};' requires an argument -While parsing file "$sourcepath/test/garbage-input.dat", line 752: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 752: Error: Invalid date/time: line amount_t amoun -While parsing file "$sourcepath/test/garbage-input.dat", line 756: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 756: Error: Directive '}' requires an argument -While parsing file "$sourcepath/test/garbage-input.dat", line 758: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 758: Error: Invalid date/time: line string amount_ -While parsing file "$sourcepath/test/garbage-input.dat", line 762: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 762: Error: Directive '}' requires an argument -While parsing file "$sourcepath/test/garbage-input.dat", line 764: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 764: Error: Invalid date/time: line string amount_ -While parsing file "$sourcepath/test/garbage-input.dat", line 768: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 768: Error: Directive '}' requires an argument -While parsing file "$sourcepath/test/garbage-input.dat", line 770: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 770: Error: Invalid date/time: line string amount_ -While parsing file "$sourcepath/test/garbage-input.dat", line 774: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 774: Error: Directive '}' requires an argument -While parsing file "$sourcepath/test/garbage-input.dat", line 776: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 776: Error: Invalid date/time: line std::ostream& -While parsing file "$sourcepath/test/garbage-input.dat", line 782: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 782: Error: Directive '}' requires an argument -While parsing file "$sourcepath/test/garbage-input.dat", line 783: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 783: Error: Invalid date/time: line std::istream& -While parsing file "$sourcepath/test/garbage-input.dat", line 786: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 786: Error: Directive '}' requires an argument -While parsing file "$sourcepath/test/garbage-input.dat", line 789: +While parsing file "$sourcepath/test/regress/25A099C9.dat", line 789: Error: Unexpected whitespace at beginning of line 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 diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index 9cacb4e7..3611b00a 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -20,7 +20,4 @@ if (BUILD_LIBRARY) target_link_libraries(MathTests ${PYTHON_LIBRARIES}) endif() add_ledger_test(MathTests) - - set_target_properties(check PROPERTIES DEPENDS LedgerUtilTests) - set_target_properties(check PROPERTIES DEPENDS LedgerMathTests) endif() |