From 5f59749cf4c368e57790a16cd1a657f12781009e Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 6 May 2014 19:59:45 -0700 Subject: [PATCH 1/6] tools: test addons also echo their arguments --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 89b996966..9fadaa18e 100644 --- a/Makefile +++ b/Makefile @@ -562,7 +562,7 @@ ADDONS=tests/addons ADDONEXTS=pl py rb sh hs lhs rkt exe com bat addons: rm -rf $(ADDONS)/hledger-* - printf '#!/bin/sh\necho $$0\n' >$(ADDONS)/hledger-addon + printf '#!/bin/sh\necho add-on: $$0\necho args: $$*\n' >$(ADDONS)/hledger-addon for E in '' $(ADDONEXTS); do \ cp $(ADDONS)/hledger-addon $(ADDONS)/hledger-addon.$$E; done for F in addon. addon2 addon2.hs addon3.exe addon3.lhs addon4.exe add reg; do \ From 93dbc15113950823cb186635be6744a8c6d5e6e5 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 6 May 2014 20:02:00 -0700 Subject: [PATCH 2/6] doc: instead of a template, save the last announcement --- doc/ANNOUNCE | 26 ++++++++++++++++++++++++++ doc/release-announcement.tmpl | 28 ---------------------------- 2 files changed, 26 insertions(+), 28 deletions(-) create mode 100644 doc/ANNOUNCE delete mode 100644 doc/release-announcement.tmpl diff --git a/doc/ANNOUNCE b/doc/ANNOUNCE new file mode 100644 index 000000000..3c6128d2c --- /dev/null +++ b/doc/ANNOUNCE @@ -0,0 +1,26 @@ +I'm pleased to announce hledger and hledger-web 0.23! + +This release includes command-line fixes and polish, a new accounts +command, and a number of changes to the balance command relating +to --depth, --flat, and multicolumn mode, which I find has made it much +more useful. Release notes: +http://hledger.org/release-notes#hledger-023-201451 . +Contributors to this release: Peter Simons and Marko Kocić. + +hledger (http://hledger.org) is a command-line tool and haskell library +for tracking financial transactions, which are stored in a human-readable +plain text format. It can also read CSV or timelog files. It provides useful +reports, and can also help you record new transactions interactively. +Add-on commands include hledger-web (a web interface), +hledger-irr (for calculating internal rate of return) and hledger-interest +(for generating interest transactions). hledger is inspired by and largely +compatible with Ledger. + +Installation: + +cabal update; cabal install hledger [hledger-web] +(see http://hledger.org/installing for help) +or sponsor a binary at http://hledger.org/download + +Best! +-Simon diff --git a/doc/release-announcement.tmpl b/doc/release-announcement.tmpl deleted file mode 100644 index 2c0a8f3ea..000000000 --- a/doc/release-announcement.tmpl +++ /dev/null @@ -1,28 +0,0 @@ -I have released hledger and hledger-web 0.22. - -hledger is a command-line tool and haskell library for tracking -financial transactions, which are stored in a human-readable plain -text format. In addition to reporting, it can also help you record new -transactions, or convert CSV data from your bank. Add-on packages -include hledger-web (providing a web interface), hledger-irr and -hledger-interest. hledger is inspired by and largely compatible with -Ledger. For more, see http://hledger.org . - -Install it: - -cabal update; cabal install hledger [hledger-web] - -For more installation help, see http://hledger.org/MANUAL.html#installing . -Or, sponsor a ready-to-run binary for your platform: http://hledger.org/download - -Release notes (http://hledger.org/release-notes#hledger-0.XX): - -PREAMBLE - -... - -**Release contributors:** - -... - -POSTAMBLE From dd736a871c48e0a0c86fca36c1fce2aa45eb49ae Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 6 May 2014 20:04:01 -0700 Subject: [PATCH 3/6] add: drop an obsolete functional test --- tests/add.test | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/tests/add.test b/tests/add.test index 16bc8c6ab..8f2a15c87 100644 --- a/tests/add.test +++ b/tests/add.test @@ -86,22 +86,7 @@ b >>> /a +\$1000\.00/ >>>=0 -# 8. no commodity entered, the (most recent) default commodity should be applied -# (and a non-ascii commodity symbol should work) - printf 'D $1000.0\nD £1,000.00\n' >t$$.j; hledgerdev -f t$$.j add; cat t$$.j; rm -f t$$.j -<<< -2010/1/1 - -a -1000 -b - -. - ->>> /a +£1,000.00/ ->>>=0 - -# 9. default amounts should not fail to balance due to precision +# 8. default amounts should not fail to balance due to precision rm -f nosuch.journal; hledgerdev -f nosuch.journal add; rm -f nosuch.journal <<< 2010/1/1 @@ -114,7 +99,7 @@ c >>> /Amount 3 \[-0.75\]:/ >>>=0 -## 10. shouldn't add decimals if there aren't any +## 9. shouldn't add decimals if there aren't any ## printf '\n\na\n1\nb\n' | hledgerdev -f /dev/null add # hledgerdev -f /dev/null add # <<< From d1a3516c7029325426968fa5f6d18c8260a7e317 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 6 May 2014 21:00:49 -0700 Subject: [PATCH 4/6] reorganise functional tests by command/topic --- Makefile | 28 ++++++++-------- tests/{ => add}/add.test | 0 tests/addons/README | 1 - tests/addons/addons.test | 17 ++++++++++ .../87.test} | 0 .../balance.test} | 4 +-- .../date2.test} | 0 .../depth.test} | 2 +- .../{balance-flat.test => balance/flat.test} | 0 .../format.test} | 2 +- .../intervals.test} | 32 +++++++++---------- .../no-total-no-elide.test} | 0 .../precision.test} | 0 tests/balance/sample.journal | 1 + tests/{command-line.test => cli/cli.test} | 17 ---------- tests/{ => cli}/no-such-file.test | 0 .../query-args.test} | 0 tests/{read-csv.test => csv/read.test} | 0 tests/decimals-balance-failure.test | 10 ------ tests/eliding-print.test.notimplemented | 9 ------ tests/eliding-register.test.notimplemented | 7 ---- tests/{ => journal}/balance-assertions.test | 0 .../blank-description.test} | 0 tests/{ => journal}/comments.test | 0 .../{parse-dates.test => journal/dates.test} | 0 tests/{ => journal}/default-commodity.test | 0 tests/{ => journal}/include.test | 0 .../{ => journal}/parens-in-account-name.test | 0 .../parse-sample-journal.test} | 0 tests/{ => journal}/unbalanced.test | 0 tests/{ => misc}/aliases.test | 0 .../amount-rendering.test} | 16 +++++++++- tests/{ => misc}/commodities.test | 0 tests/{ => misc}/precision.test | 0 tests/{ => misc}/prices.test | 0 tests/{status.test => misc/query-status.test} | 0 tests/{ => misc}/tags.test | 0 .../virtual-postings.test} | 0 .../unicode-account-matching.test | 0 tests/{ => nonascii}/unicode-balance.test | 0 .../unicode-description-matching.test | 0 .../{ => nonascii}/unicode-error-message.test | 0 tests/{ => nonascii}/unicode-print.test | 0 tests/{ => nonascii}/unicode-register.test | 0 tests/null-accountname-component.test | 7 ---- tests/parse-posting-error-pos.test | 13 -------- tests/{print-date2.test => print/date2.test} | 0 .../long-account-name.test} | 0 .../query-desc.test} | 0 .../query-not-acct.test} | 0 .../date2.test} | 0 .../depth.test} | 0 .../intervals.test} | 0 tests/{ => stats}/stats.test | 0 tests/timelog-stack-overflow.test | 13 -------- tests/{ => timelog}/timelog.test | 0 tests/timelog/timezone.test.notimplemented | 22 +++++++++++++ tests/timezone.test | 22 ------------- tests/zero-handling.test | 13 -------- 59 files changed, 89 insertions(+), 147 deletions(-) rename tests/{ => add}/add.test (100%) delete mode 100644 tests/addons/README create mode 100644 tests/addons/addons.test rename tests/{87-wrong-balance.test => balance/87.test} (100%) rename tests/{balance-sample.test => balance/balance.test} (86%) rename tests/{balance-date2.test => balance/date2.test} (100%) rename tests/{balance-depth.test => balance/depth.test} (68%) rename tests/{balance-flat.test => balance/flat.test} (100%) rename tests/{balance-custom-format.test => balance/format.test} (83%) rename tests/{balance-multicol.test => balance/intervals.test} (87%) rename tests/{balance-eliding.test => balance/no-total-no-elide.test} (100%) rename tests/{balance-precision.test => balance/precision.test} (100%) create mode 120000 tests/balance/sample.journal rename tests/{command-line.test => cli/cli.test} (89%) rename tests/{ => cli}/no-such-file.test (100%) rename tests/{filter-patterns.test => cli/query-args.test} (100%) rename tests/{read-csv.test => csv/read.test} (100%) delete mode 100644 tests/decimals-balance-failure.test delete mode 100644 tests/eliding-print.test.notimplemented delete mode 100644 tests/eliding-register.test.notimplemented rename tests/{ => journal}/balance-assertions.test (100%) rename tests/{parse-blank-description.test => journal/blank-description.test} (100%) rename tests/{ => journal}/comments.test (100%) rename tests/{parse-dates.test => journal/dates.test} (100%) rename tests/{ => journal}/default-commodity.test (100%) rename tests/{ => journal}/include.test (100%) rename tests/{ => journal}/parens-in-account-name.test (100%) rename tests/{parse-ledger-sample.test => journal/parse-sample-journal.test} (100%) rename tests/{ => journal}/unbalanced.test (100%) rename tests/{ => misc}/aliases.test (100%) rename tests/{amount-layout-vertical.test => misc/amount-rendering.test} (90%) rename tests/{ => misc}/commodities.test (100%) rename tests/{ => misc}/precision.test (100%) rename tests/{ => misc}/prices.test (100%) rename tests/{status.test => misc/query-status.test} (100%) rename tests/{ => misc}/tags.test (100%) rename tests/{virtual.test => misc/virtual-postings.test} (100%) rename tests/{ => nonascii}/unicode-account-matching.test (100%) rename tests/{ => nonascii}/unicode-balance.test (100%) rename tests/{ => nonascii}/unicode-description-matching.test (100%) rename tests/{ => nonascii}/unicode-error-message.test (100%) rename tests/{ => nonascii}/unicode-print.test (100%) rename tests/{ => nonascii}/unicode-register.test (100%) delete mode 100644 tests/null-accountname-component.test delete mode 100644 tests/parse-posting-error-pos.test rename tests/{print-date2.test => print/date2.test} (100%) rename tests/{print-long-account.test => print/long-account-name.test} (100%) rename tests/{print-desc-pattern.test => print/query-desc.test} (100%) rename tests/{print-acct-pattern.test => print/query-not-acct.test} (100%) rename tests/{register-date2.test => register/date2.test} (100%) rename tests/{register-depth.test => register/depth.test} (100%) rename tests/{register-intervals.test => register/intervals.test} (100%) rename tests/{ => stats}/stats.test (100%) delete mode 100644 tests/timelog-stack-overflow.test rename tests/{ => timelog}/timelog.test (100%) create mode 100644 tests/timelog/timezone.test.notimplemented delete mode 100644 tests/timezone.test delete mode 100644 tests/zero-handling.test diff --git a/Makefile b/Makefile index 9fadaa18e..98d045619 100644 --- a/Makefile +++ b/Makefile @@ -396,11 +396,23 @@ unittest-interpreted: # run functional tests, requires shelltestrunner >= 0.9 from hackage # 16 threads sometimes gives "commitAndReleaseBuffer: resource vanished (Broken pipe)" here but seems harmless -functest: bin/hledgerdev +functest: bin/hledgerdev tests/addons/hledger-addon @echo functional tests: - @($(SHELLTEST) tests -- --threads=16 --hide-successes \ + @($(SHELLTEST) --execdir tests -- --threads=16 --hide-successes \ && echo $@ PASSED) || echo $@ FAILED +# generate dummy add-ons for testing (hledger-addon the rest) +ADDONEXTS=pl py rb sh hs lhs rkt exe com bat +tests/addons/hledger-addon: + rm -rf tests/addons/hledger-* + printf '#!/bin/sh\necho add-on: $$0\necho args: $$*\n' >tests/ADDONS/hledger-addon + for E in '' $(ADDONEXTS); do \ + cp tests/ADDONS/hledger-addon tests/ADDONS/hledger-addon.$$E; done + for F in addon. addon2 addon2.hs addon3.exe addon3.lhs addon4.exe add reg; do \ + cp tests/ADDONS/hledger-addon tests/ADDONS/hledger-$$F; done + mkdir tests/ADDONS/hledger-addondir + chmod +x tests/ADDONS/hledger-* + # run unit and functional tests with a specific GHC version # some functional tests (add, include, read-csv..) have bin/hledgerdev hard coded - might need to symlink it test-ghc-%: # bin/hledgerdev.ghc-$* @@ -558,18 +570,6 @@ data/10000x10000x10.journal: tools/generatejournal data/100000x1000x10.journal: tools/generatejournal tools/generatejournal 100000 1000 10 >$@ -ADDONS=tests/addons -ADDONEXTS=pl py rb sh hs lhs rkt exe com bat -addons: - rm -rf $(ADDONS)/hledger-* - printf '#!/bin/sh\necho add-on: $$0\necho args: $$*\n' >$(ADDONS)/hledger-addon - for E in '' $(ADDONEXTS); do \ - cp $(ADDONS)/hledger-addon $(ADDONS)/hledger-addon.$$E; done - for F in addon. addon2 addon2.hs addon3.exe addon3.lhs addon4.exe add reg; do \ - cp $(ADDONS)/hledger-addon $(ADDONS)/hledger-$$F; done - mkdir $(ADDONS)/hledger-addondir - chmod +x $(ADDONS)/hledger-* - ###################################################################### # DOCUMENTATION diff --git a/tests/add.test b/tests/add/add.test similarity index 100% rename from tests/add.test rename to tests/add/add.test diff --git a/tests/addons/README b/tests/addons/README deleted file mode 100644 index 52da21517..000000000 --- a/tests/addons/README +++ /dev/null @@ -1 +0,0 @@ -Add-on scripts to test add-on detection (when this directory is added to PATH). diff --git a/tests/addons/addons.test b/tests/addons/addons.test new file mode 100644 index 000000000..7d395580a --- /dev/null +++ b/tests/addons/addons.test @@ -0,0 +1,17 @@ +# "make test" sets up the dummy add-on scripts required for these tests + +# 14. flags after an add-command are handled by the add-on +PATH=$PATH:. hledgerdev addon --help +>>> /hledger-addon/ +>>>=0 + +# 15. add-on flags which are not also defined in the main executable are a problem +PATH=$PATH:. hledgerdev addon --addonflag +>>>2 /Unknown flag: --addonflag/ +>>>=1 + +# 16. hledger main executable ignores anything after -- (and hides the -- from the add-on) +PATH=$PATH:. hledgerdev addon --help -- --addonflag +>>> /hledger-addon/ +>>>=0 + diff --git a/tests/87-wrong-balance.test b/tests/balance/87.test similarity index 100% rename from tests/87-wrong-balance.test rename to tests/balance/87.test diff --git a/tests/balance-sample.test b/tests/balance/balance.test similarity index 86% rename from tests/balance-sample.test rename to tests/balance/balance.test index 76c8097ba..3b1668bd3 100644 --- a/tests/balance-sample.test +++ b/tests/balance/balance.test @@ -1,5 +1,5 @@ # 1. -hledgerdev -f data/sample.journal balance +hledgerdev -f sample.journal balance >>> $-1 assets $1 bank:saving @@ -16,7 +16,7 @@ hledgerdev -f data/sample.journal balance >>>=0 # 2. -hledgerdev -f data/sample.journal balance o +hledgerdev -f sample.journal balance o >>> $1 expenses:food $-2 income diff --git a/tests/balance-date2.test b/tests/balance/date2.test similarity index 100% rename from tests/balance-date2.test rename to tests/balance/date2.test diff --git a/tests/balance-depth.test b/tests/balance/depth.test similarity index 68% rename from tests/balance-depth.test rename to tests/balance/depth.test index c27fed4cc..7b970c498 100644 --- a/tests/balance-depth.test +++ b/tests/balance/depth.test @@ -1,5 +1,5 @@ # 1 -hledgerdev -f data/sample.journal balance --no-total --depth 1 +hledgerdev -f sample.journal balance --no-total --depth 1 >>> $-1 assets $2 expenses diff --git a/tests/balance-flat.test b/tests/balance/flat.test similarity index 100% rename from tests/balance-flat.test rename to tests/balance/flat.test diff --git a/tests/balance-custom-format.test b/tests/balance/format.test similarity index 83% rename from tests/balance-custom-format.test rename to tests/balance/format.test index 05b53dff6..bf4005284 100644 --- a/tests/balance-custom-format.test +++ b/tests/balance/format.test @@ -1,4 +1,4 @@ -hledgerdev -f data/sample.journal balance --format="%30(account) %-.20(total)" +hledgerdev -f sample.journal balance --format="%30(account) %-.20(total)" >>> assets $-1 bank:saving $1 diff --git a/tests/balance-multicol.test b/tests/balance/intervals.test similarity index 87% rename from tests/balance-multicol.test rename to tests/balance/intervals.test index ccaf7074d..1a94f595c 100644 --- a/tests/balance-multicol.test +++ b/tests/balance/intervals.test @@ -1,7 +1,7 @@ # multi-column balance reports # 1. Here are the postings used in most tests below: -hledgerdev -f data/balance-multicol.journal register +hledgerdev -f balance-multicol.journal register >>> 2012/12/31 (assets:checking) 10 10 2013/01/01 (assets:checking) 1 11 @@ -12,7 +12,7 @@ hledgerdev -f data/balance-multicol.journal register >>>=0 # 2. A period balance (flow) report. --no-total also works but isn't pretty. -hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --no-total +hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' --no-total >>> Change of balance (flow): @@ -27,7 +27,7 @@ Change of balance (flow): >>>=0 # 3. With --empty, includes leading/trailing empty periods -#hledgerdev -f data/balance-multicol.journal balance -p 'quarterly in 2013' --empty +#hledgerdev -f balance-multicol.journal balance -p 'quarterly in 2013' --empty hledgerdev -f - balance -p 'quarterly in 2013' --empty <<< 2012/12/31 @@ -49,7 +49,7 @@ Change of balance (flow): # 4. A cumulative ending balance report. Column totals are the sum of # the highest-level displayed accounts (here, assets). -hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --cumulative +hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' --cumulative >>> Ending balance (cumulative): @@ -66,7 +66,7 @@ Ending balance (cumulative): # 5. With the assets:cash account excluded. As with a single-column # balance --flat report, or ledger's balance --flat, assets' balance # includes the displayed subaccount and not the excluded one. -hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --cumulative not:cash +hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' --cumulative not:cash >>> Ending balance (cumulative): @@ -80,7 +80,7 @@ Ending balance (cumulative): >>>=0 # 6. A historical ending balance report. -hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --historical +hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' --historical >>> Ending balance (historical): @@ -96,7 +96,7 @@ Ending balance (historical): # 7. With top-level accounts excluded. As always, column totals are the sum of # the highest-level displayed accounts, now assets:cash and assets:checking. -hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' not:assets$ +hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' not:assets$ >>> Change of balance (flow): @@ -110,7 +110,7 @@ Change of balance (flow): >>>=0 # 8. cumulative: -hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' not:assets$ --cumulative +hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' not:assets$ --cumulative >>> Ending balance (cumulative): @@ -124,7 +124,7 @@ Ending balance (cumulative): >>>=0 # 9. historical -hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --historical +hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' --historical >>> Ending balance (historical): @@ -141,7 +141,7 @@ Ending balance (historical): # --depth # 10. A flow report with depth limiting. The depth limit aggregates the three accounts as "assets". -hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --depth 1 +hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' --depth 1 >>> Change of balance (flow): @@ -154,7 +154,7 @@ Change of balance (flow): >>>=0 # 11. As above, but postings in the top-level assets account have been excluded. -hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --depth 1 assets: +hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' --depth 1 assets: >>> Change of balance (flow): @@ -167,7 +167,7 @@ Change of balance (flow): >>>=0 # 12. A cumulative balance report with depth limiting. -hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --depth 1 --cumulative +hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' --depth 1 --cumulative >>> Ending balance (cumulative): @@ -180,7 +180,7 @@ Ending balance (cumulative): >>>=0 # 13. A historical balance report with depth limiting. -hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --depth 1 --historical +hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' --depth 1 --historical >>> Ending balance (historical): @@ -193,7 +193,7 @@ Ending balance (historical): >>>=0 # 14. The three multicol balance report types again, this time with --tree -hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --tree +hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' --tree >>> Change of balance (flow): @@ -208,7 +208,7 @@ Change of balance (flow): >>>=0 # 15. -hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --cumulative --tree +hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' --cumulative --tree >>> Ending balance (cumulative): @@ -223,7 +223,7 @@ Ending balance (cumulative): >>>=0 # 16. -hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --historical --tree +hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' --historical --tree >>> Ending balance (historical): diff --git a/tests/balance-eliding.test b/tests/balance/no-total-no-elide.test similarity index 100% rename from tests/balance-eliding.test rename to tests/balance/no-total-no-elide.test diff --git a/tests/balance-precision.test b/tests/balance/precision.test similarity index 100% rename from tests/balance-precision.test rename to tests/balance/precision.test diff --git a/tests/balance/sample.journal b/tests/balance/sample.journal new file mode 120000 index 000000000..8f14a625d --- /dev/null +++ b/tests/balance/sample.journal @@ -0,0 +1 @@ +../../data/sample.journal \ No newline at end of file diff --git a/tests/command-line.test b/tests/cli/cli.test similarity index 89% rename from tests/command-line.test rename to tests/cli/cli.test index bda22b455..4fe235f6a 100644 --- a/tests/command-line.test +++ b/tests/cli/cli.test @@ -131,20 +131,3 @@ hledgerdev register -f/dev/null --alias=somealiases --rules-file -? -h --help -- >>> /^register \[OPTIONS\]/ >>>=0 -# do "make addons" to set up for these: - -# 14. flags after an add-command are handled by the add-on -PATH=$PATH:tests/addons hledgerdev addon --help ->>> /hledger-addon/ ->>>=0 - -# 15. add-on flags which are not also defined in the main executable are a problem -PATH=$PATH:tests/addons hledgerdev addon --addonflag ->>>2 /Unknown flag: --addonflag/ ->>>=1 - -# 16. hledger main executable ignores anything after -- (and hides the -- from the add-on) -PATH=$PATH:tests/addons hledgerdev addon --help -- --addonflag ->>> /hledger-addon/ ->>>=0 - diff --git a/tests/no-such-file.test b/tests/cli/no-such-file.test similarity index 100% rename from tests/no-such-file.test rename to tests/cli/no-such-file.test diff --git a/tests/filter-patterns.test b/tests/cli/query-args.test similarity index 100% rename from tests/filter-patterns.test rename to tests/cli/query-args.test diff --git a/tests/read-csv.test b/tests/csv/read.test similarity index 100% rename from tests/read-csv.test rename to tests/csv/read.test diff --git a/tests/decimals-balance-failure.test b/tests/decimals-balance-failure.test deleted file mode 100644 index e2a542982..000000000 --- a/tests/decimals-balance-failure.test +++ /dev/null @@ -1,10 +0,0 @@ -# b amount with no decimal places, in middle, causes balance failure (0.6.1) -hledgerdev -f - print -<<< -2009/1/1 x - a $1.25 - b $-1 - c $-0.25 - ->>>2 ->>>=0 diff --git a/tests/eliding-print.test.notimplemented b/tests/eliding-print.test.notimplemented deleted file mode 100644 index 271d4e84c..000000000 --- a/tests/eliding-print.test.notimplemented +++ /dev/null @@ -1,9 +0,0 @@ -hledgerdev -f- print -<<< -2009/1/1 x - aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa €1 - b ->>> -2009/01/01 x - aa:aaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa - b diff --git a/tests/eliding-register.test.notimplemented b/tests/eliding-register.test.notimplemented deleted file mode 100644 index bffa2351a..000000000 --- a/tests/eliding-register.test.notimplemented +++ /dev/null @@ -1,7 +0,0 @@ -hledgerdev -f- register -<<< -2009/1/1 x aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa €1 - b ->>> -2009/01/01 x aa:aa:aaaaaaaaaaaaaaaa €1 €1 - b €-1 0 diff --git a/tests/balance-assertions.test b/tests/journal/balance-assertions.test similarity index 100% rename from tests/balance-assertions.test rename to tests/journal/balance-assertions.test diff --git a/tests/parse-blank-description.test b/tests/journal/blank-description.test similarity index 100% rename from tests/parse-blank-description.test rename to tests/journal/blank-description.test diff --git a/tests/comments.test b/tests/journal/comments.test similarity index 100% rename from tests/comments.test rename to tests/journal/comments.test diff --git a/tests/parse-dates.test b/tests/journal/dates.test similarity index 100% rename from tests/parse-dates.test rename to tests/journal/dates.test diff --git a/tests/default-commodity.test b/tests/journal/default-commodity.test similarity index 100% rename from tests/default-commodity.test rename to tests/journal/default-commodity.test diff --git a/tests/include.test b/tests/journal/include.test similarity index 100% rename from tests/include.test rename to tests/journal/include.test diff --git a/tests/parens-in-account-name.test b/tests/journal/parens-in-account-name.test similarity index 100% rename from tests/parens-in-account-name.test rename to tests/journal/parens-in-account-name.test diff --git a/tests/parse-ledger-sample.test b/tests/journal/parse-sample-journal.test similarity index 100% rename from tests/parse-ledger-sample.test rename to tests/journal/parse-sample-journal.test diff --git a/tests/unbalanced.test b/tests/journal/unbalanced.test similarity index 100% rename from tests/unbalanced.test rename to tests/journal/unbalanced.test diff --git a/tests/aliases.test b/tests/misc/aliases.test similarity index 100% rename from tests/aliases.test rename to tests/misc/aliases.test diff --git a/tests/amount-layout-vertical.test b/tests/misc/amount-rendering.test similarity index 90% rename from tests/amount-layout-vertical.test rename to tests/misc/amount-rendering.test index d5cf3b997..5a5aeb244 100644 --- a/tests/amount-layout-vertical.test +++ b/tests/misc/amount-rendering.test @@ -46,7 +46,21 @@ hledgerdev -f - balance 0 >>>=0 -# 4. mixed amounts with prices +# 4. a zero amount is always displayed as just "0", regardless of any commodity/decimal places/price (like ledger) +# +hledgerdev -f- print --empty +<<< +2010/3/1 x + a $0.00 @ 3EUR + b +>>> +2010/03/01 x + a 0 + b 0 + +>>>=0 + +# 5. mixed amounts with prices # XXX # hledgerdev -f - print # <<< diff --git a/tests/commodities.test b/tests/misc/commodities.test similarity index 100% rename from tests/commodities.test rename to tests/misc/commodities.test diff --git a/tests/precision.test b/tests/misc/precision.test similarity index 100% rename from tests/precision.test rename to tests/misc/precision.test diff --git a/tests/prices.test b/tests/misc/prices.test similarity index 100% rename from tests/prices.test rename to tests/misc/prices.test diff --git a/tests/status.test b/tests/misc/query-status.test similarity index 100% rename from tests/status.test rename to tests/misc/query-status.test diff --git a/tests/tags.test b/tests/misc/tags.test similarity index 100% rename from tests/tags.test rename to tests/misc/tags.test diff --git a/tests/virtual.test b/tests/misc/virtual-postings.test similarity index 100% rename from tests/virtual.test rename to tests/misc/virtual-postings.test diff --git a/tests/unicode-account-matching.test b/tests/nonascii/unicode-account-matching.test similarity index 100% rename from tests/unicode-account-matching.test rename to tests/nonascii/unicode-account-matching.test diff --git a/tests/unicode-balance.test b/tests/nonascii/unicode-balance.test similarity index 100% rename from tests/unicode-balance.test rename to tests/nonascii/unicode-balance.test diff --git a/tests/unicode-description-matching.test b/tests/nonascii/unicode-description-matching.test similarity index 100% rename from tests/unicode-description-matching.test rename to tests/nonascii/unicode-description-matching.test diff --git a/tests/unicode-error-message.test b/tests/nonascii/unicode-error-message.test similarity index 100% rename from tests/unicode-error-message.test rename to tests/nonascii/unicode-error-message.test diff --git a/tests/unicode-print.test b/tests/nonascii/unicode-print.test similarity index 100% rename from tests/unicode-print.test rename to tests/nonascii/unicode-print.test diff --git a/tests/unicode-register.test b/tests/nonascii/unicode-register.test similarity index 100% rename from tests/unicode-register.test rename to tests/nonascii/unicode-register.test diff --git a/tests/null-accountname-component.test b/tests/null-accountname-component.test deleted file mode 100644 index c8859305b..000000000 --- a/tests/null-accountname-component.test +++ /dev/null @@ -1,7 +0,0 @@ -# hledgerdev -f - balance -E -# <<< -# 2009/1/1 x -# a: 13 -# b -# >>>2 /accountname seems ill-formed: a:/ -# >>>= 1 diff --git a/tests/parse-posting-error-pos.test b/tests/parse-posting-error-pos.test deleted file mode 100644 index e9a5e7587..000000000 --- a/tests/parse-posting-error-pos.test +++ /dev/null @@ -1,13 +0,0 @@ -# should give an accurate parse error location -# hledgerdev -f- stat -# <<< -# 2010/1/1 x -# a 1 -# b - -# 2010/1/1 y -# c: 1 -# d - -# >>>2 /line 6, column 5/ -# >>>= 1 diff --git a/tests/print-date2.test b/tests/print/date2.test similarity index 100% rename from tests/print-date2.test rename to tests/print/date2.test diff --git a/tests/print-long-account.test b/tests/print/long-account-name.test similarity index 100% rename from tests/print-long-account.test rename to tests/print/long-account-name.test diff --git a/tests/print-desc-pattern.test b/tests/print/query-desc.test similarity index 100% rename from tests/print-desc-pattern.test rename to tests/print/query-desc.test diff --git a/tests/print-acct-pattern.test b/tests/print/query-not-acct.test similarity index 100% rename from tests/print-acct-pattern.test rename to tests/print/query-not-acct.test diff --git a/tests/register-date2.test b/tests/register/date2.test similarity index 100% rename from tests/register-date2.test rename to tests/register/date2.test diff --git a/tests/register-depth.test b/tests/register/depth.test similarity index 100% rename from tests/register-depth.test rename to tests/register/depth.test diff --git a/tests/register-intervals.test b/tests/register/intervals.test similarity index 100% rename from tests/register-intervals.test rename to tests/register/intervals.test diff --git a/tests/stats.test b/tests/stats/stats.test similarity index 100% rename from tests/stats.test rename to tests/stats/stats.test diff --git a/tests/timelog-stack-overflow.test b/tests/timelog-stack-overflow.test deleted file mode 100644 index 1b65b01a7..000000000 --- a/tests/timelog-stack-overflow.test +++ /dev/null @@ -1,13 +0,0 @@ -# this gave a stack space overflow error with 0.8-0.9 due to infinite -# recursion in Posting and Transaction's equality tests: -hledgerdev -f - balance -<<< -i 2010/1/1 09:00:00 a:b -o 2010/1/1 09:03:00 ->>>=0 -# incidentally this didn't trigger it.. go figure -#hledgerdev -f - balance -#<<< -#i 2010/1/1 09:00:00 a:b -#o 2010/1/1 09:02:00 -#>>>=0 diff --git a/tests/timelog.test b/tests/timelog/timelog.test similarity index 100% rename from tests/timelog.test rename to tests/timelog/timelog.test diff --git a/tests/timelog/timezone.test.notimplemented b/tests/timelog/timezone.test.notimplemented new file mode 100644 index 000000000..bc700010c --- /dev/null +++ b/tests/timelog/timezone.test.notimplemented @@ -0,0 +1,22 @@ +# timezone-related tests +# 1. as in ledger, historical prices may contain a time and timezone. +# hledger ignores them and uses 00:00 local time instead. +# XXX needs --value not --cost +hledgerdev -f - balance --no-total --cost +<<< +P 2011/01/01 00:00:00 A $1 +P 2011/01/01 15:00:00-0100 A $2 + +2010/12/31 + (20101231) 1 A + +2011/1/1 + (20110101) 1 A + +2011/1/2 + (20110102) 1 A +>>> + 1 A 20101231 + $2 20110101 + $2 20110102 +>>>=0 diff --git a/tests/timezone.test b/tests/timezone.test deleted file mode 100644 index 903d8b6ea..000000000 --- a/tests/timezone.test +++ /dev/null @@ -1,22 +0,0 @@ -# timezone-related tests -# 1. as in ledger, historical prices may contain a time and timezone. -# hledger ignores them and uses 00:00 local time instead. -# XXX needs --value not --cost -# hledgerdev -f - balance --no-total --cost -# <<< -# P 2011/01/01 00:00:00 A $1 -# P 2011/01/01 15:00:00-0100 A $2 - -# 2010/12/31 -# (20101231) 1 A - -# 2011/1/1 -# (20110101) 1 A - -# 2011/1/2 -# (20110102) 1 A -# >>> -# 1 A 20101231 -# $2 20110101 -# $2 20110102 -# >>>=0 diff --git a/tests/zero-handling.test b/tests/zero-handling.test deleted file mode 100644 index 0659bedbf..000000000 --- a/tests/zero-handling.test +++ /dev/null @@ -1,13 +0,0 @@ -# a zero amount is always displayed as just "0", regardless of any commodity/decimal places/price (like ledger) -# -hledgerdev -f- print --empty -<<< -2010/3/1 x - a $0.00 @ 3EUR - b ->>> -2010/03/01 x - a 0 - b 0 - ->>>=0 From 88f18adbc4ee3bdd345b94bbe0ca98ce19f5f932 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 6 May 2014 21:35:38 -0700 Subject: [PATCH 5/6] show posting dates in debug output --- hledger-lib/Hledger/Data/Posting.hs | 3 ++- hledger-lib/Hledger/Data/Transaction.hs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hledger-lib/Hledger/Data/Posting.hs b/hledger-lib/Hledger/Data/Posting.hs index e28401ff9..df903e3ae 100644 --- a/hledger-lib/Hledger/Data/Posting.hs +++ b/hledger-lib/Hledger/Data/Posting.hs @@ -81,9 +81,10 @@ posting = nullposting post :: AccountName -> Amount -> Posting post acct amt = posting {paccount=acct, pamount=mixed amt} +-- XXX once rendered user output, but just for debugging now; clean up showPosting :: Posting -> String showPosting p@Posting{paccount=a,pamount=amt,ptype=t} = - unlines $ [concatTopPadded [showaccountname a ++ " ", showamount amt, showComment (pcomment p)]] + unlines $ [concatTopPadded [show (postingDate p) ++ " ", showaccountname a ++ " ", showamount amt, showComment (pcomment p)]] where ledger3ishlayout = False acctnamewidth = if ledger3ishlayout then 25 else 22 diff --git a/hledger-lib/Hledger/Data/Transaction.hs b/hledger-lib/Hledger/Data/Transaction.hs index b506a621e..360fb3c0f 100644 --- a/hledger-lib/Hledger/Data/Transaction.hs +++ b/hledger-lib/Hledger/Data/Transaction.hs @@ -122,7 +122,7 @@ tests_showTransactionUnelided = [ ] ] --- XXX overlaps showPosting +-- cf showPosting showTransaction' :: Bool -> Transaction -> String showTransaction' elide t = unlines $ [descriptionline] From 2bd785c3fba838fbe10c8735a9422c1c2973f2d5 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 6 May 2014 21:36:04 -0700 Subject: [PATCH 6/6] aregister: fix date filtering with disordered txns (fixes #184) Fix a refactoring-related regression that the tests missed: if transactions were not ordered by date in the journal, register could include postings before the report start date in the output. --- hledger-lib/Hledger/Reports/PostingsReport.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hledger-lib/Hledger/Reports/PostingsReport.hs b/hledger-lib/Hledger/Reports/PostingsReport.hs index 00f4a093a..f44e81d75 100644 --- a/hledger-lib/Hledger/Reports/PostingsReport.hs +++ b/hledger-lib/Hledger/Reports/PostingsReport.hs @@ -66,7 +66,7 @@ postingsReport opts q j = (totallabel, items) dbg "ps3" $ (if related_ opts then concatMap relatedPostings else id) $ -- with -r, replace each with its sibling postings dbg "ps2" $ filter (reportq `matchesPosting`) $ -- filter postings by the query, including before the report start date, ignoring depth dbg "ps1" $ journalPostings $ journalSelectingAmountFromOpts opts j - (precedingps, reportps) = dbg "precedingps, reportps" $ span (beforestartq `matchesPosting`) pstoend + (precedingps, reportps) = dbg "precedingps, reportps" $ partition (beforestartq `matchesPosting`) pstoend empty = queryEmpty q -- displayexpr = display_ opts -- XXX