diff options
Diffstat (limited to 'test')
47 files changed, 1182 insertions, 18 deletions
diff --git a/test/CheckBaselineTests.py b/test/CheckBaselineTests.py index 8659d1b5..f53c59a2 100755 --- a/test/CheckBaselineTests.py +++ b/test/CheckBaselineTests.py @@ -23,7 +23,6 @@ class CheckBaselineTests (CheckOptions): 'args-only', 'debug', 'download', - 'force-color', 'force-pager', 'generated', 'help', diff --git a/test/DocTests.py b/test/DocTests.py index 7af7abc3..52632a7b 100755 --- a/test/DocTests.py +++ b/test/DocTests.py @@ -192,6 +192,8 @@ class DocTests: error = None try: verify = subprocess.check_output(command, stderr=subprocess.STDOUT) + if sys.platform == 'win32': + verify = verify.replace('\r\n', '\n') valid = (output == verify) or (not error and validation) except subprocess.CalledProcessError, e: error = e.output diff --git a/test/LedgerHarness.py b/test/LedgerHarness.py index 39a31286..63d6a0ec 100755 --- a/test/LedgerHarness.py +++ b/test/LedgerHarness.py @@ -86,6 +86,13 @@ class LedgerHarness: if os.path.isfile(valgrind) and '--verify' in insert: command = valgrind + ' -q ' + command + # If we are running under msys2, use bash to execute the test commands + if 'MSYSTEM' in os.environ: + bash_path = os.environ['MINGW_PREFIX'] + '/../usr/bin/bash.exe' + return Popen([bash_path, '-c', command], shell=False, + close_fds=False, env=env, stdin=PIPE, stdout=PIPE, + stderr=PIPE, cwd=self.sourcepath) + return Popen(command, shell=True, close_fds=True, env=env, stdin=PIPE, stdout=PIPE, stderr=PIPE, cwd=self.sourcepath) diff --git a/test/RegressTests.py b/test/RegressTests.py index a5bab42d..58869edc 100755 --- a/test/RegressTests.py +++ b/test/RegressTests.py @@ -98,6 +98,13 @@ class RegressFile(object): def run_test(self, test): use_stdin = False + if sys.platform == 'win32': + test['command'] = test['command'].replace('/dev/null', 'nul') + # There is no equivalent to /dev/stdout, /dev/stderr, /dev/stdin + # on Windows, so skip tests that require them. + if '/dev/std' in test['command']: + harness.success() + return if test['command'].find("-f ") != -1: test['command'] = '$ledger ' + test['command'] if re.search("-f (-|/dev/stdin)(\s|$)", test['command']): @@ -122,7 +129,16 @@ class RegressFile(object): printed = False index = 0 if test['output'] is not None: - for line in unified_diff(test['output'], harness.readlines(p.stdout)): + process_output = harness.readlines(p.stdout) + expected_output = test['output'] + if sys.platform == 'win32': + process_output = [l.replace('\r\n', '\n').replace('\\', '/') + for l in process_output] + # Replace \ with / in the expected output because the line above + # makes it impossible for the process output to have a \. + expected_output = [l.replace('\\', '/') for l in expected_output] + + for line in unified_diff(expected_output, process_output): index += 1 if index < 3: continue @@ -135,8 +151,14 @@ class RegressFile(object): printed = False index = 0 - if test['error'] is not None: - for line in unified_diff(test['error'], harness.readlines(p.stderr)): + process_error = harness.readlines(p.stderr) + if test['error'] is not None or process_error is not None: + if test['error'] is None: + test['error'] = [] + if sys.platform == 'win32': + process_error = [l.replace('\r\n', '\n').replace('\\', '/') + for l in process_error] + for line in unified_diff(test['error'], process_error): index += 1 if index < 3: continue diff --git a/test/baseline/cmd-tags.test b/test/baseline/cmd-tags.test index bfff763a..926bdbfd 100644 --- a/test/baseline/cmd-tags.test +++ b/test/baseline/cmd-tags.test @@ -33,6 +33,7 @@ a b bar foo +xxx end test test tags --values @@ -42,6 +43,7 @@ b b: bbb bar foo +xxx end test test tags --values --count @@ -51,5 +53,6 @@ test tags --values --count 1 b: bbb 1 bar 1 foo +2 xxx end test diff --git a/test/baseline/feat-balance_assert-off.test b/test/baseline/feat-balance_assert-off.test index fed24d4a..d1da753e 100644 --- a/test/baseline/feat-balance_assert-off.test +++ b/test/baseline/feat-balance_assert-off.test @@ -13,6 +13,6 @@ While parsing file "$FILE", line 8: While parsing posting: Assets:Cash -$10 = $80 ^^^ -Error: Balance assertion off by $-10 (expected to see $100) +Error: Balance assertion off by $-10 (expected to see $90) end test diff --git a/test/baseline/feat-balance_assert_split.test b/test/baseline/feat-balance_assert_split.test index 2d9cce9f..ad299325 100644 --- a/test/baseline/feat-balance_assert_split.test +++ b/test/baseline/feat-balance_assert_split.test @@ -14,7 +14,7 @@ 2012-01-04 Test ; UUID: foo - Liabilities:MasterCard $150.00 = $-300 + Liabilities:MasterCard $150.00 = $-150 <Assets:Checking> 2012-01-04 Test @@ -24,7 +24,7 @@ 2012-01-04 Test ; UUID: baz - Liabilities:MasterCard $150.00 = $0 + Liabilities:MasterCard $150.00 = $150 <Assets:Checking> ;; b.dat diff --git a/test/baseline/feat-value-expr.test b/test/baseline/feat-value-expr.test index 01f9780b..885fd194 100644 --- a/test/baseline/feat-value-expr.test +++ b/test/baseline/feat-value-expr.test @@ -77,7 +77,7 @@ account Expenses:Food5 2012-03-07 KFC Expenses:Food7 1 CAD - Assets:Cas7 + Assets:Cash7 2012-03-08 XACT Expenses:Food8 $1 diff --git a/test/baseline/opt-color.test b/test/baseline/opt-color.test index a7d702bd..a0abdffc 100644 --- a/test/baseline/opt-color.test +++ b/test/baseline/opt-color.test @@ -2,10 +2,10 @@ Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00 Income:Dividends:Vanguard:VMMXX $-0.35 -test bal --color --force-color - 0.350 VMMXX [34mAssets:Investments:Vanguard:VMMXX[0m - [31m$-0.35[0m [34mIncome:Dividends:Vanguard:VMMXX[0m +test bal --color + 0.350 VMMXX Assets:Investments:Vanguard:VMMXX + $-0.35 Income:Dividends:Vanguard:VMMXX -------------------- - [31m$-0.35[0m + $-0.35 0.350 VMMXX end test diff --git a/test/baseline/opt-force-color.test b/test/baseline/opt-force-color.test new file mode 100644 index 00000000..536c3834 --- /dev/null +++ b/test/baseline/opt-force-color.test @@ -0,0 +1,19 @@ +2007/02/02 RD VMMXX + Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00 + Income:Dividends:Vanguard:VMMXX $-0.35 + +test bal --force-color + 0.350 VMMXX [34mAssets:Investments:Vanguard:VMMXX[0m + [31m$-0.35[0m [34mIncome:Dividends:Vanguard:VMMXX[0m +-------------------- + [31m$-0.35[0m + 0.350 VMMXX +end test + +test bal + 0.350 VMMXX Assets:Investments:Vanguard:VMMXX + $-0.35 Income:Dividends:Vanguard:VMMXX +-------------------- + $-0.35 + 0.350 VMMXX +end test diff --git a/test/baseline/opt-prepend-format.test b/test/baseline/opt-prepend-format.test index 105930f1..de79d72e 100644 --- a/test/baseline/opt-prepend-format.test +++ b/test/baseline/opt-prepend-format.test @@ -15,3 +15,8 @@ VMMXX07-Feb-02 RD VMMXX As:Inves:Vanguar:VMMXX 0.350 VMMXX 0.350 VMMXX In:Divid:Vanguar:VMMXX $-0.35 $-0.35 0.350 VMMXX end test + +test accounts --prepend-format "%(account_base) " +VMMXX Assets:Investments:Vanguard:VMMXX +VMMXX Income:Dividends:Vanguard:VMMXX +end test diff --git a/test/baseline/opt-prepend-width.test b/test/baseline/opt-prepend-width.test index c20baeb4..0efd220f 100644 --- a/test/baseline/opt-prepend-width.test +++ b/test/baseline/opt-prepend-width.test @@ -15,3 +15,8 @@ test reg --prepend-format "%(account_base) " --prepend-width=10 VMMXX In:Divid:Vanguar:VMMXX $-0.35 $-0.35 0.350 VMMXX end test + +test accounts --prepend-format "%(account_base) " --prepend-width=10 + VMMXX Assets:Investments:Vanguard:VMMXX + VMMXX Income:Dividends:Vanguard:VMMXX +end test diff --git a/test/convert.py b/test/convert.py index 857d4d30..2ac7a21b 100755 --- a/test/convert.py +++ b/test/convert.py @@ -3,7 +3,7 @@ # convert.py: This script converts a Boost.Test unit test into an # equivalent Python unit test. # -# Copyright (c) 2003-2016, John Wiegley. All rights reserved. +# Copyright (c) 2003-2018, John Wiegley. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are diff --git a/test/regress/1055.test b/test/regress/1055.test new file mode 100644 index 00000000..e3e997fa --- /dev/null +++ b/test/regress/1055.test @@ -0,0 +1,26 @@ +2011-01-01 * Opening balance + Assets:Broker 250.00 GBP = 250.00 GBP + Equity:Opening balance -250.00 GBP + +2011-02-01 * Buy 1 AAA for 10.00 GBP + Assets:Broker 1 AAA = 1 AAA + Assets:Broker -10.00 GBP + +2011-03-01 * Buy 1 AAA for 10.00 GBP + Assets:Broker 1 AAA = 2 AAA + Assets:Broker -10.00 GBP + +2011-04-01 * Buy 1 BBB for 15.00 GBP + Assets:Broker 1 BBB = 1 BBB + Assets:Broker -15.00 GBP + +test bal + 2 AAA + 1 BBB + 215.00 GBP Assets:Broker + -250.00 GBP Equity:Opening balance +-------------------- + 2 AAA + 1 BBB + -35.00 GBP +end test diff --git a/test/regress/1057.test b/test/regress/1057.test index 1cd91ee7..07eb2dbf 100644 --- a/test/regress/1057.test +++ b/test/regress/1057.test @@ -3,7 +3,7 @@ Dépense:Maison:Service:Poste * Passif:Crédit:BanqueAccord -171,63 € -test -f test/regress/1057.test --now=2014/06/27 emacs +test --now=2014/06/27 emacs (("$sourcepath/test/regress/1057.test" 1 (21308 60112 0) nil "www.amazon.fr" (2 "Dépense:Loisir:Ordi:Matériel" "101,50 €" nil " disque dur portable 2,5\" 2000 Go") (3 "Dépense:Maison:Service:Poste" "70,13 €" nil) 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/1132.test b/test/regress/1132.test new file mode 100644 index 00000000..d912ddcf --- /dev/null +++ b/test/regress/1132.test @@ -0,0 +1,16 @@ +1994/09/02=1994/08/25 * Joe + Actif:Courant:BnpCc 126,00 F + Actif:Remboursement:Autre -126,00 F = 0,00 F + +1994/10/20=1994/08/25 * (3551465) Bill + Actif:Remboursement:Autre 126,00 F + Actif:Courant:BnpCc + +test bal -> 1 +__ERROR__ +While parsing file "$FILE", line 3: +While parsing posting: + Actif:Remboursement:Autre -126,00 F = 0,00 F + ^^^^^^ +Error: Balance assertion off by 126,00 F (expected to see -126,00 F) +end test diff --git a/test/regress/1147-a.test b/test/regress/1147-a.test new file mode 100644 index 00000000..e999c312 --- /dev/null +++ b/test/regress/1147-a.test @@ -0,0 +1,12 @@ +2000/01/01 Pre-transaction balance + A $5.00 = $0.00 + B + +test bal -> 1 +__ERROR__ +While parsing file "$FILE", line 2: +While parsing posting: + A $5.00 = $0.00 + ^^^^^ +Error: Balance assertion off by $-5.00 (expected to see $5.00) +end test diff --git a/test/regress/1147-b.test b/test/regress/1147-b.test new file mode 100644 index 00000000..d3a1cffc --- /dev/null +++ b/test/regress/1147-b.test @@ -0,0 +1,10 @@ +2000/01/01 Post-transaction balance + A $5.00 = $5.00 + B + +test bal + $5.00 A + $-5.00 B +-------------------- + 0 +end test diff --git a/test/regress/1159.test b/test/regress/1159.test new file mode 100644 index 00000000..72da771a --- /dev/null +++ b/test/regress/1159.test @@ -0,0 +1,29 @@ +2003/09/13 a payee ; sat + A $100.00 + B + +2003/09/14 a payee ; mon + A $100.00 + B + +2004/10/15 a payee ; fri + A $50.00 + B + +2004/10/19 a payee ; tue + A $50.00 + B + +;sun first day of month +test reg -p "every 12 months from 2001/04/01" +03-Apr-01 - 04-Mar-31 A $200.00 $200.00 + B $-200.00 0 +04-Apr-01 - 05-Mar-31 A $100.00 $100.00 + B $-100.00 0 +end test +test reg -p 'every 12 months' +03-Sep-01 - 04-Aug-31 A $200.00 $200.00 + B $-200.00 0 +04-Sep-01 - 05-Aug-31 A $100.00 $100.00 + B $-100.00 0 +end test diff --git a/test/regress/1182_1.test b/test/regress/1182_1.test new file mode 100644 index 00000000..e9c399e6 --- /dev/null +++ b/test/regress/1182_1.test @@ -0,0 +1,12 @@ += +2000/01/01 Test + A $1.00 + B + +test bal -> 1 +__ERROR__ +While parsing file "$FILE", line 1: +While parsing automated transaction: +> = +Error: Expected predicate after '=' +end test diff --git a/test/regress/1182_2.test b/test/regress/1182_2.test new file mode 100644 index 00000000..d3c88dd8 --- /dev/null +++ b/test/regress/1182_2.test @@ -0,0 +1,17 @@ +2000/01/01 Test + A $1.00 + B + +============ + +2000/01/02 Test + A $1.00 + B + +test bal -> 1 +__ERROR__ +While parsing file "$FILE", line 5: +While parsing automated transaction: +> ============ +Error: Expected predicate after '=' +end test diff --git a/test/regress/1187_1.test b/test/regress/1187_1.test new file mode 100644 index 00000000..484146ce --- /dev/null +++ b/test/regress/1187_1.test @@ -0,0 +1,19 @@ +2006/08/17 * Au Bon Bec + Dépense:Alimentation:Restaurant 100,00 € + Passif:Crédit:Banque + +2006/08/20 * Retrait + Dépense:Liquide 60,00 € + Passif:Crédit:Banque -60,00 € + Passif:Crédit:Banque 60,00 € = -100,00 € + Actif:Courant:Cc -60,00 € + +test bal + -60,00 € Actif:Courant:Cc + 160,00 € Dépense + 100,00 € Alimentation:Restaurant + 60,00 € Liquide + -100,00 € Passif:Crédit:Banque +-------------------- + 0 +end test diff --git a/test/regress/1187_2.test b/test/regress/1187_2.test new file mode 100644 index 00000000..432a40f2 --- /dev/null +++ b/test/regress/1187_2.test @@ -0,0 +1,18 @@ +2001/01/01 * Balance + Actif:Courant:Cc 10000,00 F = 10000,00 F + Equity + +2002/01/11 * Passage à l'euro + Actif:Courant:Cc -10000,00 F = 0,00 F + Actif:Courant:Cc 1524,49 € = 1524,49 € + Revenu:Devise 10000,00 F + Revenu:Devise -1524,49 € + +test bal + 1524,49 € Actif:Courant:Cc + -10000,00 F Equity + 10000,00 F + -1524,49 € Revenu:Devise +-------------------- + 0 +end test diff --git a/test/regress/1187_3.test b/test/regress/1187_3.test new file mode 100644 index 00000000..2c6d7452 --- /dev/null +++ b/test/regress/1187_3.test @@ -0,0 +1,36 @@ +2000/01/01 Multiple posts + A $5.00 + B $7.20 + C $-114.99 + D + +2000/01/02 Many assertions + A $2.00 + A $3.00 = $10.00 + B $0.80 = $8.00 + C $-0.01 = $-115.00 + B $1.00 + C $1 + C $4 = $-110 + D + +2000/01/03 Incremental + A $1.00 = $11.00 + A $1.00 = $12.00 + A $1.00 = $13.00 + D + +2000/01/04 Assignment + A $2 + A = $25 + D $-10 + D $-2 + +test bal + $25.00 A + $9.00 B + $-110.00 C + $76.00 D +-------------------- + 0 +end test diff --git a/test/regress/1187_4.test b/test/regress/1187_4.test new file mode 100644 index 00000000..4804d5c6 --- /dev/null +++ b/test/regress/1187_4.test @@ -0,0 +1,32 @@ +2000/01/01 Multiple commodities + A $5.00 + A 32 F + B $-12 + C + +2000/01/02 Assertions + A $1 = $6 + A 1 F = 33 F + A $1 = $7 + A 1 F = 34 F + B 3 F = 3 F + B $12 = $0 + B 1 F = 4 F + C + +2000/01/03 Assignments + A = $0 + A -4 F = 30 F + B $-7 = $-7 + B = 0 F + C $14 + C 8 F + +test bal + 30 F A + $-7.00 B + $7.00 + -30 F C +-------------------- + 0 +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/370-budget_period_days.test b/test/regress/370-budget_period_days.test new file mode 100644 index 00000000..459c5071 --- /dev/null +++ b/test/regress/370-budget_period_days.test @@ -0,0 +1,27 @@ +;budgets care about start dates +~ every 14 days from 2010/02/23 + Expenses:Bills:Housecleaning $85.00 + Assets:Bank:Checking + +;before Sun aug 01 2010 +;now is Mon jun 21 2010 +;a Tuesday? +; +test reg --budget --now=2010/06/13 +10-Feb-23 Budget transaction Ex:Bills:Housecleaning $-85.00 $-85.00 +10-Feb-23 Budget transaction Assets:Bank:Checking $85.00 0 +10-Mar-09 Budget transaction Ex:Bills:Housecleaning $-85.00 $-85.00 +10-Mar-09 Budget transaction Assets:Bank:Checking $85.00 0 +10-Mar-23 Budget transaction Ex:Bills:Housecleaning $-85.00 $-85.00 +10-Mar-23 Budget transaction Assets:Bank:Checking $85.00 0 +10-Apr-06 Budget transaction Ex:Bills:Housecleaning $-85.00 $-85.00 +10-Apr-06 Budget transaction Assets:Bank:Checking $85.00 0 +10-Apr-20 Budget transaction Ex:Bills:Housecleaning $-85.00 $-85.00 +10-Apr-20 Budget transaction Assets:Bank:Checking $85.00 0 +10-May-04 Budget transaction Ex:Bills:Housecleaning $-85.00 $-85.00 +10-May-04 Budget transaction Assets:Bank:Checking $85.00 0 +10-May-18 Budget transaction Ex:Bills:Housecleaning $-85.00 $-85.00 +10-May-18 Budget transaction Assets:Bank:Checking $85.00 0 +10-Jun-01 Budget transaction Ex:Bills:Housecleaning $-85.00 $-85.00 +10-Jun-01 Budget transaction Assets:Bank:Checking $85.00 0 +end test diff --git a/test/regress/370-budget_period_weeks.test b/test/regress/370-budget_period_weeks.test new file mode 100644 index 00000000..8d4801a6 --- /dev/null +++ b/test/regress/370-budget_period_weeks.test @@ -0,0 +1,29 @@ +;budgets care about start dates +~ every 2 weeks from 2010/02/23 + Expenses:Bills:Housecleaning $85.00 + Assets:Bank:Checking + +;before Sun aug 01 2010 +;now is Mon jun 21 2010 +;a Tuesday? +; +test reg --budget --now=2010/06/13 +10-Feb-23 Budget transaction Ex:Bills:Housecleaning $-85.00 $-85.00 +10-Feb-23 Budget transaction Assets:Bank:Checking $85.00 0 +10-Feb-28 Budget transaction Ex:Bills:Housecleaning $-85.00 $-85.00 +10-Feb-28 Budget transaction Assets:Bank:Checking $85.00 0 +10-Mar-14 Budget transaction Ex:Bills:Housecleaning $-85.00 $-85.00 +10-Mar-14 Budget transaction Assets:Bank:Checking $85.00 0 +10-Mar-28 Budget transaction Ex:Bills:Housecleaning $-85.00 $-85.00 +10-Mar-28 Budget transaction Assets:Bank:Checking $85.00 0 +10-Apr-11 Budget transaction Ex:Bills:Housecleaning $-85.00 $-85.00 +10-Apr-11 Budget transaction Assets:Bank:Checking $85.00 0 +10-Apr-25 Budget transaction Ex:Bills:Housecleaning $-85.00 $-85.00 +10-Apr-25 Budget transaction Assets:Bank:Checking $85.00 0 +10-May-09 Budget transaction Ex:Bills:Housecleaning $-85.00 $-85.00 +10-May-09 Budget transaction Assets:Bank:Checking $85.00 0 +10-May-23 Budget transaction Ex:Bills:Housecleaning $-85.00 $-85.00 +10-May-23 Budget transaction Assets:Bank:Checking $85.00 0 +10-Jun-06 Budget transaction Ex:Bills:Housecleaning $-85.00 $-85.00 +10-Jun-06 Budget transaction Assets:Bank:Checking $85.00 0 +end test diff --git a/test/regress/370-forecast_period_days.test b/test/regress/370-forecast_period_days.test new file mode 100644 index 00000000..faf9d47b --- /dev/null +++ b/test/regress/370-forecast_period_days.test @@ -0,0 +1,17 @@ +;does not care about start date +~ every 14 days from 2010/02/23 + Expenses:Bills:Housecleaning $85.00 + Assets:Bank:Checking + +;before Sun aug 01 2010 +;now is Mon jun 21 2010 +;a Tuesday? +;forecasts period start is now first forecast transaction is now + 1 'tomorrow' +test reg --forecast 'date <[2010/08/01]' --now=2010/06/13 +10-Jun-27 Forecast transaction Ex:Bills:Housecleaning $85.00 $85.00 +10-Jun-27 Forecast transaction Assets:Bank:Checking $-85.00 0 +10-Jul-11 Forecast transaction Ex:Bills:Housecleaning $85.00 $85.00 +10-Jul-11 Forecast transaction Assets:Bank:Checking $-85.00 0 +10-Jul-25 Forecast transaction Ex:Bills:Housecleaning $85.00 $85.00 +10-Jul-25 Forecast transaction Assets:Bank:Checking $-85.00 0 +end test diff --git a/test/regress/370-forecast_period_weeks.test b/test/regress/370-forecast_period_weeks.test new file mode 100644 index 00000000..3927a48d --- /dev/null +++ b/test/regress/370-forecast_period_weeks.test @@ -0,0 +1,16 @@ +;Tuesday +~ every 2 weeks from 2010/02/23 + Expenses:Bills:Housecleaning $85.00 + Assets:Bank:Checking + +;before Sun aug 01 2010 +;now is Mon jun 21 2010 +;a Sunday +test reg --forecast 'date <[2010/08/01]' --now=2010/06/21 +10-Jun-27 Forecast transaction Ex:Bills:Housecleaning $85.00 $85.00 +10-Jun-27 Forecast transaction Assets:Bank:Checking $-85.00 0 +10-Jul-11 Forecast transaction Ex:Bills:Housecleaning $85.00 $85.00 +10-Jul-11 Forecast transaction Assets:Bank:Checking $-85.00 0 +10-Jul-25 Forecast transaction Ex:Bills:Housecleaning $85.00 $85.00 +10-Jul-25 Forecast transaction Assets:Bank:Checking $-85.00 0 +end test diff --git a/test/regress/370-period.test b/test/regress/370-period.test new file mode 100644 index 00000000..81275da6 --- /dev/null +++ b/test/regress/370-period.test @@ -0,0 +1,443 @@ +;period days should not be alligned + +test period 'every 14 days from 2011/10/03' +--- Period expression tokens --- +TOK_EVERY: every +TOK_INT: 14 +TOK_DAYS: days +TOK_SINCE: since +TOK_DATE: year 2011 month Oct day 3 +END_REACHED: <EOF> + +--- Before stabilization --- + range: from year 2011 month Oct day 3 +duration: 14 days + +--- After stabilization --- + range: from year 2011 month Oct day 3 + start: 11-Oct-03 +duration: 14 days + +--- Sample dates in range (max. 20) --- + 1: 11-Oct-03 -- 11-Oct-16 + 2: 11-Oct-17 -- 11-Oct-30 + 3: 11-Oct-31 -- 11-Nov-13 + 4: 11-Nov-14 -- 11-Nov-27 + 5: 11-Nov-28 -- 11-Dec-11 + 6: 11-Dec-12 -- 11-Dec-25 + 7: 11-Dec-26 -- 12-Jan-08 + 8: 12-Jan-09 -- 12-Jan-22 + 9: 12-Jan-23 -- 12-Feb-05 +10: 12-Feb-06 -- 12-Feb-19 +11: 12-Feb-20 -- 12-Mar-04 +12: 12-Mar-05 -- 12-Mar-18 +13: 12-Mar-19 -- 12-Apr-01 +14: 12-Apr-02 -- 12-Apr-15 +15: 12-Apr-16 -- 12-Apr-29 +16: 12-Apr-30 -- 12-May-13 +17: 12-May-14 -- 12-May-27 +18: 12-May-28 -- 12-Jun-10 +19: 12-Jun-11 -- 12-Jun-24 +20: 12-Jun-25 -- 12-Jul-08 +end test +;ensure weeks behave as before +test period 'every 1 weeks from 2011/10/03' +--- Period expression tokens --- +TOK_EVERY: every +TOK_INT: 1 +TOK_WEEKS: weeks +TOK_SINCE: since +TOK_DATE: year 2011 month Oct day 3 +END_REACHED: <EOF> + +--- Before stabilization --- + range: from year 2011 month Oct day 3 +duration: 1 week + +--- After stabilization --- + range: from year 2011 month Oct day 3 + start: 11-Oct-03 +duration: 1 week + +--- Sample dates in range (max. 20) --- + 1: 11-Oct-03 -- 11-Oct-08 + 2: 11-Oct-09 -- 11-Oct-15 + 3: 11-Oct-16 -- 11-Oct-22 + 4: 11-Oct-23 -- 11-Oct-29 + 5: 11-Oct-30 -- 11-Nov-05 + 6: 11-Nov-06 -- 11-Nov-12 + 7: 11-Nov-13 -- 11-Nov-19 + 8: 11-Nov-20 -- 11-Nov-26 + 9: 11-Nov-27 -- 11-Dec-03 +10: 11-Dec-04 -- 11-Dec-10 +11: 11-Dec-11 -- 11-Dec-17 +12: 11-Dec-18 -- 11-Dec-24 +13: 11-Dec-25 -- 11-Dec-31 +14: 12-Jan-01 -- 12-Jan-07 +15: 12-Jan-08 -- 12-Jan-14 +16: 12-Jan-15 -- 12-Jan-21 +17: 12-Jan-22 -- 12-Jan-28 +18: 12-Jan-29 -- 12-Feb-04 +19: 12-Feb-05 -- 12-Feb-11 +20: 12-Feb-12 -- 12-Feb-18 +end test +test period 'every 2 weeks from 2011/10/03' +--- Period expression tokens --- +TOK_EVERY: every +TOK_INT: 2 +TOK_WEEKS: weeks +TOK_SINCE: since +TOK_DATE: year 2011 month Oct day 3 +END_REACHED: <EOF> + +--- Before stabilization --- + range: from year 2011 month Oct day 3 +duration: 2 weeks + +--- After stabilization --- + range: from year 2011 month Oct day 3 + start: 11-Oct-03 +duration: 2 weeks + +--- Sample dates in range (max. 20) --- + 1: 11-Oct-03 -- 11-Oct-08 + 2: 11-Oct-09 -- 11-Oct-22 + 3: 11-Oct-23 -- 11-Nov-05 + 4: 11-Nov-06 -- 11-Nov-19 + 5: 11-Nov-20 -- 11-Dec-03 + 6: 11-Dec-04 -- 11-Dec-17 + 7: 11-Dec-18 -- 11-Dec-31 + 8: 12-Jan-01 -- 12-Jan-14 + 9: 12-Jan-15 -- 12-Jan-28 +10: 12-Jan-29 -- 12-Feb-11 +11: 12-Feb-12 -- 12-Feb-25 +12: 12-Feb-26 -- 12-Mar-10 +13: 12-Mar-11 -- 12-Mar-24 +14: 12-Mar-25 -- 12-Apr-07 +15: 12-Apr-08 -- 12-Apr-21 +16: 12-Apr-22 -- 12-May-05 +17: 12-May-06 -- 12-May-19 +18: 12-May-20 -- 12-Jun-02 +19: 12-Jun-03 -- 12-Jun-16 +20: 12-Jun-17 -- 12-Jun-30 +end test +test period 'every 3 weeks from 2011/10/03' +--- Period expression tokens --- +TOK_EVERY: every +TOK_INT: 3 +TOK_WEEKS: weeks +TOK_SINCE: since +TOK_DATE: year 2011 month Oct day 3 +END_REACHED: <EOF> + +--- Before stabilization --- + range: from year 2011 month Oct day 3 +duration: 3 weeks + +--- After stabilization --- + range: from year 2011 month Oct day 3 + start: 11-Oct-03 +duration: 3 weeks + +--- Sample dates in range (max. 20) --- + 1: 11-Oct-03 -- 11-Oct-22 + 2: 11-Oct-23 -- 11-Nov-12 + 3: 11-Nov-13 -- 11-Dec-03 + 4: 11-Dec-04 -- 11-Dec-24 + 5: 11-Dec-25 -- 12-Jan-14 + 6: 12-Jan-15 -- 12-Feb-04 + 7: 12-Feb-05 -- 12-Feb-25 + 8: 12-Feb-26 -- 12-Mar-17 + 9: 12-Mar-18 -- 12-Apr-07 +10: 12-Apr-08 -- 12-Apr-28 +11: 12-Apr-29 -- 12-May-19 +12: 12-May-20 -- 12-Jun-09 +13: 12-Jun-10 -- 12-Jun-30 +14: 12-Jul-01 -- 12-Jul-21 +15: 12-Jul-22 -- 12-Aug-11 +16: 12-Aug-12 -- 12-Sep-01 +17: 12-Sep-02 -- 12-Sep-22 +18: 12-Sep-23 -- 12-Oct-13 +19: 12-Oct-14 -- 12-Nov-03 +20: 12-Nov-04 -- 12-Nov-24 +end test +test period 'every 4 weeks from 2011/10/03' +--- Period expression tokens --- +TOK_EVERY: every +TOK_INT: 4 +TOK_WEEKS: weeks +TOK_SINCE: since +TOK_DATE: year 2011 month Oct day 3 +END_REACHED: <EOF> + +--- Before stabilization --- + range: from year 2011 month Oct day 3 +duration: 4 weeks + +--- After stabilization --- + range: from year 2011 month Oct day 3 + start: 11-Oct-03 +duration: 4 weeks + +--- Sample dates in range (max. 20) --- + 1: 11-Oct-03 -- 11-Oct-22 + 2: 11-Oct-23 -- 11-Nov-19 + 3: 11-Nov-20 -- 11-Dec-17 + 4: 11-Dec-18 -- 12-Jan-14 + 5: 12-Jan-15 -- 12-Feb-11 + 6: 12-Feb-12 -- 12-Mar-10 + 7: 12-Mar-11 -- 12-Apr-07 + 8: 12-Apr-08 -- 12-May-05 + 9: 12-May-06 -- 12-Jun-02 +10: 12-Jun-03 -- 12-Jun-30 +11: 12-Jul-01 -- 12-Jul-28 +12: 12-Jul-29 -- 12-Aug-25 +13: 12-Aug-26 -- 12-Sep-22 +14: 12-Sep-23 -- 12-Oct-20 +15: 12-Oct-21 -- 12-Nov-17 +16: 12-Nov-18 -- 12-Dec-15 +17: 12-Dec-16 -- 13-Jan-12 +18: 13-Jan-13 -- 13-Feb-09 +19: 13-Feb-10 -- 13-Mar-09 +20: 13-Mar-10 -- 13-Apr-06 +end test +test period 'every 5 weeks from 2011/10/03' +--- Period expression tokens --- +TOK_EVERY: every +TOK_INT: 5 +TOK_WEEKS: weeks +TOK_SINCE: since +TOK_DATE: year 2011 month Oct day 3 +END_REACHED: <EOF> + +--- Before stabilization --- + range: from year 2011 month Oct day 3 +duration: 5 weeks + +--- After stabilization --- + range: from year 2011 month Oct day 3 + start: 11-Oct-03 +duration: 5 weeks + +--- Sample dates in range (max. 20) --- + 1: 11-Oct-03 -- 11-Oct-22 + 2: 11-Oct-23 -- 11-Nov-26 + 3: 11-Nov-27 -- 11-Dec-31 + 4: 12-Jan-01 -- 12-Feb-04 + 5: 12-Feb-05 -- 12-Mar-10 + 6: 12-Mar-11 -- 12-Apr-14 + 7: 12-Apr-15 -- 12-May-19 + 8: 12-May-20 -- 12-Jun-23 + 9: 12-Jun-24 -- 12-Jul-28 +10: 12-Jul-29 -- 12-Sep-01 +11: 12-Sep-02 -- 12-Oct-06 +12: 12-Oct-07 -- 12-Nov-10 +13: 12-Nov-11 -- 12-Dec-15 +14: 12-Dec-16 -- 13-Jan-19 +15: 13-Jan-20 -- 13-Feb-23 +16: 13-Feb-24 -- 13-Mar-30 +17: 13-Mar-31 -- 13-May-04 +18: 13-May-05 -- 13-Jun-08 +19: 13-Jun-09 -- 13-Jul-13 +20: 13-Jul-14 -- 13-Aug-17 +end test +test period 'every 6 weeks from 2011/10/03' +--- Period expression tokens --- +TOK_EVERY: every +TOK_INT: 6 +TOK_WEEKS: weeks +TOK_SINCE: since +TOK_DATE: year 2011 month Oct day 3 +END_REACHED: <EOF> + +--- Before stabilization --- + range: from year 2011 month Oct day 3 +duration: 6 weeks + +--- After stabilization --- + range: from year 2011 month Oct day 3 + start: 11-Oct-03 +duration: 6 weeks + +--- Sample dates in range (max. 20) --- + 1: 11-Oct-03 -- 11-Oct-22 + 2: 11-Oct-23 -- 11-Dec-03 + 3: 11-Dec-04 -- 12-Jan-14 + 4: 12-Jan-15 -- 12-Feb-25 + 5: 12-Feb-26 -- 12-Apr-07 + 6: 12-Apr-08 -- 12-May-19 + 7: 12-May-20 -- 12-Jun-30 + 8: 12-Jul-01 -- 12-Aug-11 + 9: 12-Aug-12 -- 12-Sep-22 +10: 12-Sep-23 -- 12-Nov-03 +11: 12-Nov-04 -- 12-Dec-15 +12: 12-Dec-16 -- 13-Jan-26 +13: 13-Jan-27 -- 13-Mar-09 +14: 13-Mar-10 -- 13-Apr-20 +15: 13-Apr-21 -- 13-Jun-01 +16: 13-Jun-02 -- 13-Jul-13 +17: 13-Jul-14 -- 13-Aug-24 +18: 13-Aug-25 -- 13-Oct-05 +19: 13-Oct-06 -- 13-Nov-16 +20: 13-Nov-17 -- 13-Dec-28 +end test +test period 'every 7 weeks from 2011/10/03' +--- Period expression tokens --- +TOK_EVERY: every +TOK_INT: 7 +TOK_WEEKS: weeks +TOK_SINCE: since +TOK_DATE: year 2011 month Oct day 3 +END_REACHED: <EOF> + +--- Before stabilization --- + range: from year 2011 month Oct day 3 +duration: 7 weeks + +--- After stabilization --- + range: from year 2011 month Oct day 3 + start: 11-Oct-03 +duration: 7 weeks + +--- Sample dates in range (max. 20) --- + 1: 11-Oct-03 -- 11-Nov-12 + 2: 11-Nov-13 -- 11-Dec-31 + 3: 12-Jan-01 -- 12-Feb-18 + 4: 12-Feb-19 -- 12-Apr-07 + 5: 12-Apr-08 -- 12-May-26 + 6: 12-May-27 -- 12-Jul-14 + 7: 12-Jul-15 -- 12-Sep-01 + 8: 12-Sep-02 -- 12-Oct-20 + 9: 12-Oct-21 -- 12-Dec-08 +10: 12-Dec-09 -- 13-Jan-26 +11: 13-Jan-27 -- 13-Mar-16 +12: 13-Mar-17 -- 13-May-04 +13: 13-May-05 -- 13-Jun-22 +14: 13-Jun-23 -- 13-Aug-10 +15: 13-Aug-11 -- 13-Sep-28 +16: 13-Sep-29 -- 13-Nov-16 +17: 13-Nov-17 -- 14-Jan-04 +18: 14-Jan-05 -- 14-Feb-22 +19: 14-Feb-23 -- 14-Apr-12 +20: 14-Apr-13 -- 14-May-31 +end test +test period 'every 8 weeks from 2011/10/03' +--- Period expression tokens --- +TOK_EVERY: every +TOK_INT: 8 +TOK_WEEKS: weeks +TOK_SINCE: since +TOK_DATE: year 2011 month Oct day 3 +END_REACHED: <EOF> + +--- Before stabilization --- + range: from year 2011 month Oct day 3 +duration: 8 weeks + +--- After stabilization --- + range: from year 2011 month Oct day 3 + start: 11-Oct-03 +duration: 8 weeks + +--- Sample dates in range (max. 20) --- + 1: 11-Oct-03 -- 11-Nov-19 + 2: 11-Nov-20 -- 12-Jan-14 + 3: 12-Jan-15 -- 12-Mar-10 + 4: 12-Mar-11 -- 12-May-05 + 5: 12-May-06 -- 12-Jun-30 + 6: 12-Jul-01 -- 12-Aug-25 + 7: 12-Aug-26 -- 12-Oct-20 + 8: 12-Oct-21 -- 12-Dec-15 + 9: 12-Dec-16 -- 13-Feb-09 +10: 13-Feb-10 -- 13-Apr-06 +11: 13-Apr-07 -- 13-Jun-01 +12: 13-Jun-02 -- 13-Jul-27 +13: 13-Jul-28 -- 13-Sep-21 +14: 13-Sep-22 -- 13-Nov-16 +15: 13-Nov-17 -- 14-Jan-11 +16: 14-Jan-12 -- 14-Mar-08 +17: 14-Mar-09 -- 14-May-03 +18: 14-May-04 -- 14-Jun-28 +19: 14-Jun-29 -- 14-Aug-23 +20: 14-Aug-24 -- 14-Oct-18 +end test +test period 'every 9 weeks from 2011/10/03' +--- Period expression tokens --- +TOK_EVERY: every +TOK_INT: 9 +TOK_WEEKS: weeks +TOK_SINCE: since +TOK_DATE: year 2011 month Oct day 3 +END_REACHED: <EOF> + +--- Before stabilization --- + range: from year 2011 month Oct day 3 +duration: 9 weeks + +--- After stabilization --- + range: from year 2011 month Oct day 3 + start: 11-Oct-03 +duration: 9 weeks + +--- Sample dates in range (max. 20) --- + 1: 11-Oct-03 -- 11-Nov-12 + 2: 11-Nov-13 -- 12-Jan-14 + 3: 12-Jan-15 -- 12-Mar-17 + 4: 12-Mar-18 -- 12-May-19 + 5: 12-May-20 -- 12-Jul-21 + 6: 12-Jul-22 -- 12-Sep-22 + 7: 12-Sep-23 -- 12-Nov-24 + 8: 12-Nov-25 -- 13-Jan-26 + 9: 13-Jan-27 -- 13-Mar-30 +10: 13-Mar-31 -- 13-Jun-01 +11: 13-Jun-02 -- 13-Aug-03 +12: 13-Aug-04 -- 13-Oct-05 +13: 13-Oct-06 -- 13-Dec-07 +14: 13-Dec-08 -- 14-Feb-08 +15: 14-Feb-09 -- 14-Apr-12 +16: 14-Apr-13 -- 14-Jun-14 +17: 14-Jun-15 -- 14-Aug-16 +18: 14-Aug-17 -- 14-Oct-18 +19: 14-Oct-19 -- 14-Dec-20 +20: 14-Dec-21 -- 15-Feb-21 +end test +test period 'every 10 weeks from 2011/10/03' +--- Period expression tokens --- +TOK_EVERY: every +TOK_INT: 10 +TOK_WEEKS: weeks +TOK_SINCE: since +TOK_DATE: year 2011 month Oct day 3 +END_REACHED: <EOF> + +--- Before stabilization --- + range: from year 2011 month Oct day 3 +duration: 10 weeks + +--- After stabilization --- + range: from year 2011 month Oct day 3 + start: 11-Oct-03 +duration: 10 weeks + +--- Sample dates in range (max. 20) --- + 1: 11-Oct-03 -- 11-Oct-22 + 2: 11-Oct-23 -- 11-Dec-31 + 3: 12-Jan-01 -- 12-Mar-10 + 4: 12-Mar-11 -- 12-May-19 + 5: 12-May-20 -- 12-Jul-28 + 6: 12-Jul-29 -- 12-Oct-06 + 7: 12-Oct-07 -- 12-Dec-15 + 8: 12-Dec-16 -- 13-Feb-23 + 9: 13-Feb-24 -- 13-May-04 +10: 13-May-05 -- 13-Jul-13 +11: 13-Jul-14 -- 13-Sep-21 +12: 13-Sep-22 -- 13-Nov-30 +13: 13-Dec-01 -- 14-Feb-08 +14: 14-Feb-09 -- 14-Apr-19 +15: 14-Apr-20 -- 14-Jun-28 +16: 14-Jun-29 -- 14-Sep-06 +17: 14-Sep-07 -- 14-Nov-15 +18: 14-Nov-16 -- 15-Jan-24 +19: 15-Jan-25 -- 15-Apr-04 +20: 15-Apr-05 -- 15-Jun-13 +end test diff --git a/test/regress/383.test b/test/regress/383.test index ab4372fd..019c91eb 100644 --- a/test/regress/383.test +++ b/test/regress/383.test @@ -23,7 +23,7 @@ test bal Assets:Investments --lots --date-format %Y-%m-%d 100 AA {2.00 GBP} [2014-01-01] Assets:Investments end test -test bal Assets:Investments --lots --date-format %g-%b-%d +test bal Assets:Investments --lots --date-format %y-%b-%d 100 AA {2.00 GBP} [14-Jan-01] Assets:Investments end test diff --git a/test/input/spaces.dat b/test/regress/550-584.test index 1ada1b61..1c3be3b8 100644 --- a/test/input/spaces.dat +++ b/test/regress/550-584.test @@ -53,3 +53,21 @@ ; COM commodity has three spaces after Expenses:misc 1 COM Assets:checking + +test payees +test +testcommodity +end test + +test reg --group-by "tag('test')" +spaces +11-Nov-28 test Expenses:misc $1 $1 +11-Nov-28 test Expenses:misc $2 $3 +11-Nov-28 test Expenses:misc $4 $7 +11-Nov-28 test Expenses:misc $8 $15 +end test + +test commodities +$ +COM +end test diff --git a/test/regress/727B2DF8.test b/test/regress/727B2DF8.test index 0c32d660..ad2b903f 100644 --- a/test/regress/727B2DF8.test +++ b/test/regress/727B2DF8.test @@ -43,7 +43,7 @@ N $ Assets:Bank:Checking ; :AnotherTag: -test reg --color --force-color +test reg --force-color 04-May-01 Checking balance [34mAssets:Bank:Checking [0m $1,000.00 $1,000.00 [34mEquit:Opening Balances[0m [31m$-1,000.00[0m 0 04-May-03 Investment balance [34mAssets:Brokerage [0m 50 AAPL 50 AAPL 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/981.test b/test/regress/981.test new file mode 100644 index 00000000..2338b82a --- /dev/null +++ b/test/regress/981.test @@ -0,0 +1,29 @@ + +; Test a regex longer than 255 char + +tag Project + check value =~ /^(0ad|ankur|aptosid|archlinux|chakra|debian|debconf14|debconf15|debconf16|drizzle|ffmpeg|ffmpeg|fluxbox|freedesktop|freedombox|gallery|texmacs|haskell|jenkins|libreoffice|madwifi|mingw|openvas|openwrt|openbioinformatics|openembedded|openvoting|osunix|path64|plan9|postgresql|privoxy|smc|helios|tidesdk|tux4kids|yafaray|spi)$/ + +2016-01-01 * Test - correct tag + Expenses:Hosting 20.00 USD + ; Project: debian + Assets:Cash -20.00 USD + +2016-02-01 * Test - wrong tag + Expenses:Hosting 20.00 USD + ; Project: foo + Assets:Cash -20.00 USD + +test bal + -40.00 USD Assets:Cash + 40.00 USD Expenses:Hosting +-------------------- + 0 +__ERROR__ +Warning: "$FILE", line 15: Metadata check failed for (Project: foo): (value =~ /^(0ad|ankur|aptosid|archlinux|chakra|debian|debconf14|debconf15|debconf16|drizzle|ffmpeg|ffmpeg|fluxbox|freedesktop|freedombox|gallery|texmacs|haskell|jenkins|libreoffice|madwifi|mingw|openvas|openwrt|openbioinformatics|openembedded|openvoting|osunix|path64|plan9|postgresql|privoxy|smc|helios|tidesdk|tux4kids|yafaray|spi)$/) +end test + +test reg --limit 'payee =~ /XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/' +__ERROR__ +Warning: "$FILE", line 15: Metadata check failed for (Project: foo): (value =~ /^(0ad|ankur|aptosid|archlinux|chakra|debian|debconf14|debconf15|debconf16|drizzle|ffmpeg|ffmpeg|fluxbox|freedesktop|freedombox|gallery|texmacs|haskell|jenkins|libreoffice|madwifi|mingw|openvas|openwrt|openbioinformatics|openembedded|openvoting|osunix|path64|plan9|postgresql|privoxy|smc|helios|tidesdk|tux4kids|yafaray|spi)$/) +end test diff --git a/test/regress/B21BF389.py b/test/regress/B21BF389.py new file mode 100644 index 00000000..707ce340 --- /dev/null +++ b/test/regress/B21BF389.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from __future__ import print_function, unicode_literals + +import ledger + +for post in ledger.read_journal(__file__.replace(".py", "_py.test")).query("income"): + print(unicode(post.tag("Reference"))) diff --git a/test/regress/B21BF389_py.test b/test/regress/B21BF389_py.test new file mode 100644 index 00000000..c0a2166a --- /dev/null +++ b/test/regress/B21BF389_py.test @@ -0,0 +1,8 @@ +2016/01/11 * Employer + Assets:Checking + Income:Salary € 1.500,00 + ; Reference: Christmas bonus + +test python test/regress/B21BF389.py +Christmas bonus +end test 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/GH520.test b/test/regress/GH520.test new file mode 100644 index 00000000..54dd2299 --- /dev/null +++ b/test/regress/GH520.test @@ -0,0 +1,33 @@ +2009-01-01 * Jan 09 + A 100.00 EUR + B + +test reg --format '%(trim(""))\n' + + +end test + +test reg --format '%(trim("a"))\n' +a +a +end test + +test reg --format '%(trim(" a"))\n' +a +a +end test + +test reg --format '%(trim("a "))\n' +a +a +end test + +test reg --format '%(trim(" a "))\n' +a +a +end test + +test reg --format '%(trim(" aa "))\n' +aa +aa +end test 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/regress/market-group-by.test b/test/regress/market-group-by.test new file mode 100644 index 00000000..a0d204aa --- /dev/null +++ b/test/regress/market-group-by.test @@ -0,0 +1,26 @@ +D 1000.00 EUR + +2008/04/15 * Paid expenses back from cie. + Expenses:Cie-Reimbursements 2000 CAD @ 1.10 EUR + Assets:Checking + +2008/04/15 * Paid expenses back from cie. + Expenses:Cie-Reimbursements 2000 USD @ 1.10 EUR + Assets:Checking + +P 2008/04/20 00:00:00 CAD 1.20 EUR +P 2008/04/20 00:00:00 USD 1.20 EUR + +test reg -V --group-by commodity +CAD +08-Apr-15 Paid expenses back .. Exp:Cie-Reimbursements 2200.00 EUR 2200.00 EUR +08-Apr-20 Commodities revalued <Revalued> 200.00 EUR 2400.00 EUR + +EUR +08-Apr-15 Paid expenses back .. Assets:Checking -2200.00 EUR -2200.00 EUR +08-Apr-15 Paid expenses back .. Assets:Checking -2200.00 EUR -4400.00 EUR + +USD +08-Apr-15 Paid expenses back .. Exp:Cie-Reimbursements 2200.00 EUR 2200.00 EUR +08-Apr-20 Commodities revalued <Revalued> 200.00 EUR 2400.00 EUR +end test diff --git a/test/regress/total-1.test b/test/regress/total-1.test new file mode 100644 index 00000000..51448dd2 --- /dev/null +++ b/test/regress/total-1.test @@ -0,0 +1,28 @@ +; Test that calling total does not affect future calls to that function via a +; stale cache entry for the totalled account, because of a change to that same +; account + +2017-10-01 * Opening Balance + Assets:Current Account $1000.00 + Equity:Opening Balances + +2017-10-02 * Savings + Assets:Savings $100.00 + Assets:Current Account + +assert account("Assets:Current Account").total == $900.00 + +2017-10-03 * Savings + Assets:Savings $100.00 + Assets:Current Account + +assert account("Assets:Current Account").total == $800.00 + +test bal + $1000.00 Assets + $800.00 Current Account + $200.00 Savings + $-1000.00 Equity:Opening Balances +-------------------- + 0 +end test diff --git a/test/regress/total-2.test b/test/regress/total-2.test new file mode 100644 index 00000000..2b15650f --- /dev/null +++ b/test/regress/total-2.test @@ -0,0 +1,30 @@ +; Test that calling total does not affect future calls to that function via a +; stale cache entry for the totalled account, because of a change to an +; descendant (Assets:Current:Unallocated) of that account (Assets:Current) + +2017-10-01 * Opening entry + Assets:Current:Unallocated $2000.00 + Equity:Opening Balances + +2017-10-02 * Initial savings + Assets:Current:Savings $1000.00 + Assets:Current:Unallocated + +assert account("Assets:Current").total == $2000.00 + +2017-10-03 * Balance + Assets:Current:Unallocated $1.00 + Equity:Adjustments + +assert account("Assets:Current").total == $2001.00 + +test bal + $2001.00 Assets:Current + $1000.00 Savings + $1001.00 Unallocated + $-2001.00 Equity + $-1.00 Adjustments + $-2000.00 Opening Balances +-------------------- + 0 +end test diff --git a/test/unit/t_value.cc b/test/unit/t_value.cc index 2daedcb1..a31c84c8 100644 --- a/test/unit/t_value.cc +++ b/test/unit/t_value.cc @@ -6,6 +6,10 @@ #include "value.h" +#if defined(_WIN32) || defined(__CYGWIN__) +#include "strptime.h" +#endif + using namespace ledger; struct value_fixture { |