Commit Graph

297 Commits

Author SHA1 Message Date
Simon Michael
7f6cf1f849 balance, register, register-csv: depth 0 shows summary items (#206)
Previously, a depth:0 query produced an empty report (since there are no
level zero accounts). Now, it aggregates all data into one summary item
with account name "...".

This makes it easier to see the kind of data Gwern was looking for from
register-csv (net worth over time). Eg this shows one line per month
summarising the total of assets and liabilities:

hledger register-csv -- -MHE ^assets ^liabilities depth:0

Single and multi-column balance reports behave similarly.
2014-10-19 17:53:20 -07:00
Simon Michael
a65116ae5e fix func. test numbering 2014-09-13 21:28:07 -07:00
Simon Michael
efe7c7a029 journal: dates should be followed by whitespace or newline 2014-09-06 09:20:22 -07:00
Simon Michael
aa85e786b9 register: describe datespans briefly, like balance
Eg instead of 2014/01/01 - 2014/01/31, show 2014/01, as in a multicolumn
balance report. The data model is not very elegant, but works for now.
2014-08-08 07:34:11 -07:00
Simon Michael
7fb154f820 balance: include report span in title 2014-07-26 17:29:20 -07:00
Simon Michael
ca43eab47a balance: simplify multicolumn report titles slightly 2014-07-26 17:09:29 -07:00
Simon Michael
a7f7c3181f balance: show compact headings for common intervals
In periodic multicolumn balance reports, column headings now show a more
compact description of common periods (years, half-years, quarters,
months, weeks) for better readability and screen space efficiency.
2014-07-26 16:54:18 -07:00
Simon Michael
b499ea85eb register: optimise postingsReportItemAsText a bit
Avoid concatTopPadded when rendering register output, making that
command faster when there's a lot of output.
2014-07-07 08:37:27 -07:00
Simon Michael
e13dd554a1 tools: benchmarking updates 2014-07-06 10:19:34 -07:00
Simon Michael
3669422bbf make --width and --debug require an argument (fixes #149)
This is a workaround for a cmdargs limitation. Having "--debug 2"
or "--width 100" produce no output (because the number is parsed
as a separate argument) is too annoying.
2014-07-03 07:31:52 -07:00
Simon Michael
c31710d942 look harder for decimal point & digit groups (fixes #196)
Amount display styles have been reworked a bit; they are now calculated
after journal parsing, not during it. This allows the fix for #196:
we now search through the amounts until a decimal point is detected,
instead of just looking at the first one; likewise for digit groups.
Digit groups are now implemented with a better type.

Digit group size detection has been improved a little:
1000,000 now gives group sizes [3,4,4,...], not [3,3,...], and
10,000 gives groups sizes [3,3,...] not [3,2,2,..].
(To get [3,2,2,...] you'd use eg 00,00,000.)

There are still some old (or new ?) issues; I don't think we handle
inconsistent decimal points & digit groups too well. But for now all
tests pass.
2014-07-02 23:26:16 -07:00
Simon Michael
8ae303f685 assert only a single commodity, like Ledger (fixes #195)
This change means you can make assertions on a multi-commodity account
balance (asserting one commodity at a time). On the flip side, you can
no longer assert the complete balance of an account (new unexpected
commodities will not be detected.) We might restore that ability later,
using the == syntax.
2014-07-02 07:35:06 -07:00
Simon Michael
18716f2908 some missing functional test files 2014-05-09 17:48:51 -07:00
Simon Michael
d1a3516c70 reorganise functional tests by command/topic 2014-05-06 21:02:58 -07:00
Simon Michael
dd736a871c add: drop an obsolete functional test 2014-05-06 20:04:28 -07:00
Simon Michael
d0d2edb42f cli: drop a --display functional test 2014-05-01 07:33:24 -07:00
Simon Michael
31aac193fa make addon functional tests pass 2014-04-30 16:33:10 -07:00
Simon Michael
cfc1db1725 cli: more tests for add-on options pass-through 2014-04-27 23:33:30 -07:00
Simon Michael
dbd35fbe3e cli: clarify spec 2014-04-27 23:33:13 -07:00
Simon Michael
4381022e25 addons: move test addons under tests/ 2014-04-27 18:45:22 -07:00
Simon Michael
4ef33c012a register: report intervals now include all postings in the interval
As with balance. For example, register -p 'weekly in jan' generates
these intervals: 2013/12/30-2014/01/05, 2014/01/06-2014/01/12,
2014/01/13-2014/01/19, 2014/01/20-2014/01/26, 2014/01/27-2014/02/02.
With this change, postings on 2013/12/30-31 and 2014/2/1-2 will be
included in the report, so all period totals are complete and
comparable.
2014-04-19 11:47:05 -07:00
Simon Michael
6743f8c2a1 balance: multicolumn now includes all postings in the displayed periods 2014-04-19 08:45:46 -07:00
Simon Michael
a761ae5b86 balance: support --date2 in multicolumn reports (cf #174) 2014-04-13 15:14:07 -07:00
Simon Michael
d4993092fb register: test for #174 2014-04-13 15:12:30 -07:00
Simon Michael
2af04ec2fc balance: merge/improve multicol report implementations
Periodic, cumulative and historical multicolumn balance reports are now
generated by one code path, which helps with consistency and reducing
the bug/test surface. --tree now also works with --cumulative or
--historical.
2014-04-13 12:49:05 -07:00
Simon Michael
6a928a03a8 overhaul single- and multi-column balance reports
Changes include:

- flat mode now shows exclusive (subaccount-excluding) balances.
  This is a deviation from ledger, but seems simpler and clearer
  for users and implementors across the various modes.

- in flat mode, --depth now aggregates deeper accounts at the
  depth limit, rather than just excluding them from the report.
  This is more useful.

- in flat mode, --empty no longer shows parent accounts with
  no postings.

- more tests, more debug output, clearer code
2014-04-03 18:49:57 -07:00
Simon Michael
4dc61e76bf test and fix display of zero-balance leaves (fixes #170) 2014-04-03 18:49:57 -07:00
Simon Michael
a54e4d3c61 add: update functional test 2014-03-18 14:08:59 -07:00
Simon Michael
cf6f9d9477 add: adapt functional tests to colored output 2014-03-05 14:45:49 -08:00
Simon Michael
dcdb032d96 add: rewrite using wizards and make it more robust
The code is now much more manageable, faciliating further
improvements. Completion now works at all prompts, and
will insert the default value if the input area is empty.
Account and amount defaults are more robust and useful
in various situations. There might be a slight regression
with default commodity handling.
2014-02-27 18:15:49 -08:00
Simon Michael
bba0d702a1 move bench.tests to tests/ 2014-01-11 21:53:06 -08:00
Simon Michael
ff90fdc50b disable a failing add-on option-parsing test 2013-12-13 19:13:59 -08:00
Simon Michael
c53732a4af balance: new multi-column reports & documentation
Two new multi-column balance report modes show ending balance per
period: `--cumulative`, starting from 0, and `--historical`, starting
from the historical starting balance.

The balance command's specification has been clarified and consolidated
in the Balance.hs haddock. Reports.hs has also had haddock updates. The
old AccountsReport type is now BalanceReport, still used by
single-column balance report. The new MultiBalanceReport type is used by
the multi-column reports.
2013-12-07 05:43:31 -08:00
Simon Michael
1fb4c5956f fix test comment 2013-09-26 15:07:09 -07:00
Simon Michael
13f8c0f938 overhaul command line processing
Command line processing has been overhauled and made more consistent,
and now has tests and extensive debug output.  More flags now work
both before and after COMMAND: -f, --rule-file, --alias, --help,
--debug, --version.  Command line help, command aliases, API docs and
code have been improved.
2013-09-22 01:17:41 -07:00
Simon Michael
f9656a21af print: comment positions (same line or next line) are now preserved 2013-09-10 10:32:49 -07:00
Dmitry Astapov
550f41ee48 Tests to show bug in multiple file assigments in CSV parsing 2013-06-19 08:29:45 +01:00
Simon Michael
c2fa4b3c21 parsing: make balance assertions more robust with different precisions (#119)
Also note another issue.
2013-06-01 13:39:00 -07:00
Simon Michael
74eac84b1a parsing: function tests for balance assertions 2013-05-30 15:14:49 -07:00
Simon Michael
78837c66a6 parsing: fix test breakage due to new csv rules format (fixes #102) 2013-04-12 14:59:28 -07:00
Simon Michael
a694cfcfcd add: fix functional test breakage due to add ui cleanups (#102) 2013-04-12 14:57:39 -07:00
Simon Michael
2bb120d6c6 register: fix -w related test breakage, another width tweak (#102)
As part of adding -w in december I cleaned up/adjusted register field
widths, and didn't make all the tests pass. This commit makes one more
width adjustment
(one space after the date instead of two) and fixes all tests depending on register output.
2013-04-12 14:56:41 -07:00
Simon Michael
7fcd45614b add: ui cleanups
- tidier output
- show more help
- suggest . only for recording, not for quitting (though it still works)
- show each transaction after adding it (#52)
- don't parse . as a zero amount
- don't show [] when there's no default
2013-02-23 00:57:16 +00:00
Simon Michael
621a91807e rename actual/effective dates to primary/secondary
The command-line flag is now --date2. Alternate spellings --effective and --aux-date
are accepted for compatibility.
2012-12-06 04:43:41 +00:00
Simon Michael
e75abc4625 parse posting dates, better comment/tag handling, begin using HTF for unit testing 2012-12-06 00:28:23 +00:00
Simon Michael
211327c758 drop obsolete test 2012-12-05 23:38:48 +00:00
Simon Michael
f54e3299b9 94: fix 0.19 regression showing wrong total balance with balance --flat
and distinguish better between account depth and item indent level
2012-12-04 01:07:04 +00:00
Simon Michael
4248df5c6f clarify historical price field and tests 2012-11-20 00:27:43 +00:00
Simon Michael
cbc7661703 87: fix an arithmetic and transaction balancing bug with multiple total-priced amounts 2012-11-12 16:31:43 +00:00
Simon Michael
2b8d759db1 rename developer build to hledgerdev, avoiding confusion with production hledger 2012-10-21 18:23:23 +00:00
Simon Michael
0b96a767b4 support tilde (~) in journal and rules file paths 2012-05-30 08:36:01 +00:00
Simon Michael
074486549a make stats.test and include.test parallelizable 2012-06-29 18:05:12 +00:00
Simon Michael
24546bb910 stats: test display order of included files 2012-06-29 14:41:16 +00:00
Simon Michael
c2365c3541 update status tests 2012-06-29 18:33:45 +00:00
Simon Michael
d4a897306c combine command-line flags like --depth properly with non-flag query patterns 2012-06-29 22:36:30 +00:00
Simon Michael
70572eb837 test comment 2012-03-28 18:17:05 +00:00
Simon Michael
d4a1e51f2c functional test de-hard-codifications 2012-04-13 21:48:29 +00:00
Simon Michael
021d61b285 fix csv reading tests 2012-03-25 22:12:52 +00:00
Simon Michael
cb905a741c new query by tag implementation 2012-05-28 00:27:55 +00:00
Simon Michael
56cf9b21cb fix txn & posting comment parsing & printing; better unit tests 2012-05-15 01:49:05 +00:00
Simon Michael
0580ef69a3 disable/rename tags test 2012-05-27 18:07:58 +00:00
Simon Michael
a58a5f96ad more robust comments & metadata, on postings too, and document as "tags" 2012-05-14 18:52:22 +00:00
xiaoruoruo
ce83876700 metadata parse and show for transaction 2012-04-08 19:13:56 +00:00
Simon Michael
549bae945c metadata test updates 2012-05-06 20:43:48 +00:00
xiaoruoruo
dafa764a07 filter by metadata tag 2012-04-08 20:43:48 +00:00
Simon Michael
ca5d5020e1 prototypical incomestatement and balancesheet commands 2012-04-14 01:34:56 +00:00
Simon Michael
e9f965a2dc disable tests for non-working clear missing accountname component error message 2011-12-30 00:12:38 +00:00
Simon Michael
9bdb170a0a inferred amounts use the cost commodity if known, like ledger (#69) 2012-01-03 08:15:48 +00:00
Simon Michael
41c1fa636a parsing: -B/--cost now ignores P historical prices, like ledger 2012-01-22 20:39:11 +00:00
Simon Michael
1bc4d4b395 refactor: clarify mixed amount normalising a bit 2012-01-01 00:39:13 +00:00
Dmitry Astapov
7426e93ec6 Testcase+fix for commodity being reported more than once per account in balance 2011-12-25 21:21:27 +00:00
Simon Michael
5972ecfdb9 convert test tweaks 2012-01-30 17:18:32 +00:00
Simon Michael
5d7e601cb3 possible add test 2012-01-30 17:18:46 +00:00
Simon Michael
6ca155edc0 convert: don't reverse order of transactions 2011-09-19 03:10:16 +00:00
Simon Michael
2f313663af rename a func. test 2011-09-22 19:30:26 +00:00
Simon Michael
f79b272ff3 balance: ledger compatibility fix: don't elide parent accounts with multiple displayed subaccounts 2011-09-22 20:40:06 +00:00
Simon Michael
ea0cbaea40 docs: clarify D directive's influence on display settings once and for all 2011-09-22 22:23:28 +00:00
Simon Michael
c22e4e85d0 register: be better at showing empty intervals with --empty and a query pattern 2011-09-23 00:09:39 +00:00
Simon Michael
4a7b3b9b74 gather balance tests 2011-09-23 02:04:33 +00:00
Simon Michael
6ddf394119 add: clearer prompts, more validation, use . to end as well 2011-09-23 03:51:45 +00:00
Simon Michael
9b2a5f56e1 only the add and web commands auto-create the journal file 2011-09-23 03:53:14 +00:00
Simon Michael
35f3a4fa00 print, web: always show both dates, ignoring --effective (#42)
Ledger shows only the effective date with --effective, but not vice versa.
print is supposed to be information-preserving so this seems better.
This also fixes the web entries view.
2011-09-23 14:50:20 +00:00
Simon Michael
99e28e5c30 add: simplify filename in func tests 2011-09-30 22:54:22 +00:00
Simon Michael
11f31be37e this test looks wrong, get rid of it 2011-09-03 21:25:13 +00:00
Simon Michael
1de9cc1d80 fix a regression balancing a transaction containing different prices
And try to clarify amount arithmetic a bit more. More to come I expect.
2011-09-03 21:27:37 +00:00
Simon Michael
fa5f09f06a handle multiple filter patterns on the command-line again 2011-09-11 20:37:04 +00:00
Dmitry Astapov
fbf8eda58f One more test for implicit commodity pricing (test-for-failure) 2011-04-25 18:37:59 +00:00
Dmitry Astapov
6314080e14 Test for auto-balancing of transactions with two commodities, when first amount is negative 2011-04-24 22:10:30 +00:00
Simon Michael
8d62452260 parsing: historical price directives may contain a numeric time zone, like ledger; note that the time is ignored 2011-06-01 01:50:04 +00:00
Trygve Laugstøl
63f6bd48f2 tests/parse-ledger-sample.test: Was broken, change from ';' to '#' as comment. 2011-06-03 17:38:45 +00:00
Trygve Laugstøl
45b3a07ea7 cli: Making sure the add test remove the journal before and after the test. 2011-06-10 11:35:06 +00:00
Trygve Laugstøl
6ba1119fdc Making sure all tests call 'bin/hleder' (and not just 'hledger'). 2011-06-14 22:44:21 +00:00
Simon Michael
eeca35d6b5 update functional tests to shelltest 1.0 format 2011-08-14 22:15:39 +00:00
Simon Michael
870c687f31 update functional tests 2011-08-25 23:13:25 +00:00
Simon Michael
1273f02a9a more balance/amount clarifications and a test 2011-08-30 11:37:36 +00:00
Simon Michael
059825a9b2 optionsgeddon.. port to cmdargs and a fully modal cli 2011-08-15 22:50:09 +00:00
Trygve Laugstol
dca66a63a7 convert: Adding support for formatting expressions in description-field 2011-06-27 22:59:07 +00:00
Simon Michael
957c349780 --alias command-line option 2011-08-05 00:05:39 +00:00
Trygve Laugstol
28dbb8864f Adding basic ledger FORMAT parser. 2011-06-20 21:33:26 +00:00
Trygve Laugstøl
c582b45bf6 Adding test for the convert command's in and out fields. 2011-06-03 17:40:49 +00:00
Simon Michael
810c6a5dac print: don't show a trailing space when description is blank 2011-01-19 18:55:16 +00:00
Simon Michael
151f549450 new test, small fixes 2011-03-12 20:56:15 +00:00
Max Bolingbroke
8c3aa657b6 Add support for date-format conversion directive 2010-12-21 17:57:06 +00:00
Simon Michael
b2f439eb11 try showing integral "maxprecision" amounts without the .0 (except in add's defaults, where it helps) 2011-01-20 00:17:32 +00:00
Simon Michael
7d2dcddee3 timelog.test notes 2011-04-18 17:31:27 +00:00
Simon Michael
b159f74a4c zero amounts have no sign or commodity, and amounts with different prices are aggregated, like ledger 2011-04-22 13:50:05 +00:00
Simon Michael
d9ee8b23a6 precision tests 2011-01-21 20:52:56 +00:00
Dmitry Astapov
222a26c306 test: when total balance is zero, it should stay zero regardless of "--basis" 2011-04-19 20:15:11 +00:00
Simon Michael
ef0f054230 update shell tests for latest shelltestrunner 2011-03-12 20:55:49 +00:00
Simon Michael
e2c38d59d7 more precision tests 2011-01-20 01:08:14 +00:00
Simon Michael
c86b968cac update eliding-balance tests for latest shelltestrunner, drop an obscure test 2011-04-19 21:32:13 +00:00
Dmitry Astapov
906e2659dd test: accounts with zero balance should be elided even when multiple commodities are used 2011-04-19 20:22:14 +00:00
Simon Michael
1c7ad7f421 parsing: more careful validation of eg leap years in transaction dates (only) 2011-04-22 13:55:42 +00:00
Simon Michael
6e100703b9 update leap year tests 2011-04-19 21:40:59 +00:00
Dmitry Astapov
049ece6c72 test: effective date of 29 feb should be valid 2011-04-19 20:10:30 +00:00
Dmitry Astapov
cd2d8faaef tests: 29th feb should be correctly handled wrt leap/non-leap year 2011-04-19 20:15:14 +00:00
Simon Michael
33bedcbab0 parsing: infer a conversion price in unpriced two-commodity transactions 2011-01-20 00:18:54 +00:00
Simon Michael
c8614b9a15 amount/price func. test cleanups 2011-01-19 19:00:42 +00:00
Simon Michael
d3663b818e parsing: better international number format support (#32)
This allows period and comma to be used for decimal point and digit group
separator or vice versa, and also flexible digit groups.  See
http://en.wikipedia.org/wiki/Decimal_separator .  Digit group separators
are possibly not worth the trouble and might not stay.
2011-01-19 12:32:18 +00:00
Simon Michael
e03ada3bd3 parsing: support @@ syntax specifying total price 2011-01-15 02:04:53 +00:00
Simon Michael
d7617fe154 parsing: ignore cleared flags at the start of postings, parse account name correctly 2010-11-13 20:20:04 +00:00
Simon Michael
27a0900ea9 fix some tests 2010-11-14 20:03:49 +00:00
Simon Michael
0d6e696699 some more tests and fixes for amount & price display precision 2010-11-14 23:29:04 +00:00
Simon Michael
811e71aba7 price precisions don't influence display precision; balancing is based on display precision (#23)
Like ledger, price amounts are now "unobserved", ie their precision does
not affect the canonical display precisions used when displaying amounts,
and transaction balancing is done based on display precision, ie amounts
are considered to balance if their sum appears to be zero when using the
canonical display precision.
2010-11-14 22:44:37 +00:00
Simon Michael
e707f97847 parsing: parse transaction and posting metadata, though we don't use it yet 2010-11-13 22:17:32 +00:00
Simon Michael
c59f2f088d clean up after add tests 2010-11-19 17:25:05 +00:00
Simon Michael
fcd90212b8 add: combine tests 2010-11-16 15:59:12 +00:00
Simon Michael
ea903ffe6e add: more tests, bugfixes for add's commodity/precision handling; make all tests pass 2010-11-16 15:08:06 +00:00
Simon Michael
19e80c6c6f update failing test 2010-12-06 17:30:22 +00:00
Simon Michael
37378d6b97 add: add default commodity to commodity-less amounts (#26), misc. defaults fixes 2010-11-13 15:11:45 +00:00
Simon Michael
78db98366f parsing: support D default commodity directive 2010-11-12 23:54:21 +00:00
Simon Michael
506ec00818 register: with --depth, clip account names or aggregate postings rather than excluding them 2010-08-02 19:40:38 +00:00
Simon Michael
f05837a442 make file include test more robust (#21)
- space prefix to deter shelltest --with usage
- use the just-built hledger binary, not whatever's in PATH
- more post-test cleanup
2010-09-03 17:44:57 +00:00
Ben Boeckel
5e576e9ff0 fix-recursive-includes
Fix recursive includes beyond depth 3. Also add a test case for the bug.
2010-09-02 00:30:57 +00:00
Simon Michael
1a8353457d a test for the !include with relative paths issue (#21) 2010-08-10 02:52:53 +00:00
Simon Michael
1e7e9a54a0 fix a test for shelltestrunner 0.9 2010-09-03 20:51:01 +00:00
Simon Michael
3c08337cc2 fix no-such-file.test for testing --with something 2010-09-05 16:18:42 +00:00
Simon Michael
586c824cac display non-simple commodity names with double-quotes
This ensures print's output remains parseable. The other commands also
double-quote them, for consistency, like c++ ledger.
2010-05-27 01:38:23 +00:00
Simon Michael
2ae94a9011 make this test runnable individually 2010-07-07 10:09:57 +00:00
Simon Michael
b5d1ebba30 print, register, balance: fix layout with mixed-commodity amounts 2010-07-11 22:51:36 +00:00
Simon Michael
2f6b82122f tweak journal file auto-creation, add tests 2010-07-17 00:45:12 +00:00
Simon Michael
9acb57cfc5 add: allow blank descriptions 2010-07-17 15:13:16 +00:00
Simon Michael
6cd65ea7a6 test updates 2010-07-13 07:16:43 +00:00
Simon Michael
e510a64ec8 make tests pass 2010-05-24 20:57:40 +00:00
Simon Michael
7f8a352c0c stats: don't break on an empty file 2010-07-08 14:04:54 +00:00
Simon Michael
345bffb235 fix unbalanced test, ignoring cosmetic issue 2010-04-14 16:44:24 +00:00
Simon Michael
9c893f634a another cosmetic test fix 2010-04-14 16:57:40 +00:00
Simon Michael
35f87499f7 consolidate register depth tests 2010-05-23 17:47:56 +00:00
Simon Michael
65cf381dbc parsing: timelog entries now generate balanced transactions, using virtual postings 2010-05-23 18:54:14 +00:00
Simon Michael
be30aac3f5 fix an occasional stack overflow error due to infinite recursion in Posting/Transaction equality tests
This was happening with balance command on certain timelog entries, since 0.8.
Now, when testing two postings for equality, their parent transaction's identity is ignored.
2010-05-22 00:45:35 +00:00