Commit Graph

584 Commits

Author SHA1 Message Date
Simon Michael
02f2e3bd9b csv: refine unknown accounts more thoroughly, a better fix for #1192 2020-02-26 22:45:49 -08:00
Simon Michael
58bb0df5ab csv: undo failed #1192 fix, causing "_unknown_" accounts; refactor
Restore the old logic, while also trying to clarify this
transaction-generating code, and add some tests.
See also #1198.
2020-02-26 21:46:11 -08:00
Simon Michael
d537f1fe07 csv: allow single field matching; more docs and tests 2020-02-26 08:55:55 -08:00
Simon Michael
017d3355f8 csv: allow manual assignment of "expenses:unknown" again (fix #1192) 2020-02-15 13:52:59 -08:00
Simon Michael
e4a0bdff8d journal: default commodity (D) limits display precision too (#1187)
D directives are now fully equivalent to commodity directives for
setting a commodity's display style. (Previously it was equivalent to
a posting amount, so it couldn't limit the number of decimal places.)
When both kinds of directive exist, commodity directives take precedence.
When there are multiple D directives in the journal, only the last one
affects display style.
2020-02-11 09:47:26 -08:00
Simon Michael
1741b607e2 lib: more cleanup of amount canonicalisation helpers (#1187)
Stop exporting journalAmounts, overJournalAmounts, traverseJournalAmounts.
Rename journalAmounts helper to journalStyleInfluencingAmounts.

D directives are now a little better at influencing amount
canonicalisation, eg in the updated test case.
2020-02-11 09:23:04 -08:00
Simon Michael
242bf528fd ;tests: convert default commodity tests to new format
[ci skip]
2020-02-11 08:34:22 -08:00
Simon Michael
dad4d9b662 print: be sure to value all postings; -V/-X/--value now imply -x
Previously -B implied -x; now any of the valuation flags do.
This avoids a bug where print -V of a transaction with an implicit
commodity conversion would convert only some of its postings to value.

Also, more valuation tests.
2020-02-10 12:41:36 -08:00
Simon Michael
aa96b41efe print, register: add --value=then, valuing at each posting's date
Currently this will give an error with other kinds of report.
2020-02-10 08:20:39 -08:00
Simon Michael
b3711488a7 lib: apply canonical display styles to auto posting amounts too 2020-01-31 06:00:06 -08:00
Simon Michael
81b92be803 ; close: update flag names in tests
[ci skip]
2020-01-22 15:25:10 -08:00
Simon Michael
44ee3a5984 ;close: remove redundant test data 2020-01-22 14:30:12 -08:00
Simon Michael
f1110d163d close: --close-desc/--open-desc customise the descriptions (#1165) 2020-01-22 14:30:12 -08:00
Simon Michael
7500002ee5 close: hide equity amounts by default, for simpler entries (#1165)
-x/--explicit shows them, as with print.
2020-01-22 12:52:16 -08:00
Simon Michael
2645b76ff0 close: hide prices by default, show them with --show-costs (#1165)
close no longer preserves costs, generating huge entries when there
are many foreign currency/investment transactions, unless you ask it to.
2020-01-22 12:52:01 -08:00
Simon Michael
98b90a8a7b ;close: cleanups (#1165) 2020-01-22 08:26:59 -08:00
Simon Michael
69bc8f803b close: fix some inappropriate rounding, ensure the txn balances (#1164) 2020-01-20 18:01:33 -08:00
Simon Michael
1e9f30bafc close: add the --interleaved flag; refactor a little
Interleaved equity postings make troubleshooting easier.
2020-01-20 18:01:29 -08:00
Jakob Schöttl
c7a88b50fb Fix timeclock format parsing
Fix presumably copy-paste errors

timeclock format has only timeclock lines or empty/comment lines

Update test format to v3, add new tests

Throw error on unexpected clock codes in timeclock format

Fix missing case in pattern matching
2020-01-12 13:17:36 -08:00
Brian Wignall
c823f5b51a Get "make functest" working again 2020-01-07 15:58:54 -08:00
Brian Wignall
03e68f3925 Get "make functest" working again 2020-01-07 15:58:54 -08:00
Brian Wignall
e12b0a4f05 Get "make functest" working again 2020-01-07 15:58:54 -08:00
Brian Wignall
28f9f043e5 Get "make functest" (mostly) working again 2020-01-07 15:58:54 -08:00
Aleksandar Dimitrov
8df4e1ed83 Remove --separator command line argument 2020-01-05 14:45:57 -08:00
Aleksandar Dimitrov
93c27891f2 Fix numbering in csv.test 2020-01-05 14:45:57 -08:00
Aleksandar Dimitrov
02d9205af7 Allow separator to be overridden from command line
This also fixes that parsing separators on the command line and the
rules file was not handled the same way.
2020-01-05 14:45:57 -08:00
Aleksandar Dimitrov
8163053027 Add functional test 2020-01-05 14:45:57 -08:00
Simon Michael
8f1aa0981e ;make that auto posting test independent of current date
[ci skip]
2020-01-04 17:36:57 -08:00
Aleksandar Dimitrov
f55f814155 Fix auto postings test.
Happy new year!
2020-01-02 09:54:14 -08:00
Simon Michael
4026e08797 ;tests: fix some func tests broken by c6da152e 2019-12-28 21:08:27 -08:00
Jacek Generowicz
24fbe313dd ;Fix rewrite tests after #457 fix
As a consequence of fixing #457, two rewrite tests fail, because extra
quotes appear in the output of the commands being tested.

These quotes appear in comments which reflect the command which was
run in order to produce the output. Instead of

   ; generated-posting: = assets:bank and amt:<0

we now get

   ; generated-posting: = assets:bank and "amt:<0"

Given that the quotes around `amt:<0` are necessary for the command to
work properly, these quotes should really be there in the expected
output.

Hence this commit modifies the expected output of the tests, by adding
in the quotes. This makes the tests pass once more.
2019-12-08 18:33:43 +01:00
Jacek Generowicz
c6da152e9a ;convert extant addon tests to shellrunner format 3 2019-12-08 18:33:43 +01:00
Jacek Generowicz
4593963fef ;Disable tests according to discussion in #457
https://github.com/simonmichael/hledger/pull/1140#issuecomment-562793255
2019-12-08 18:33:43 +01:00
Jacek Generowicz
7394441728 ;Add shelltests demonstrating bug reported in issue 457 2019-12-08 18:33:43 +01:00
Simon Michael
5b6dbe86b3 close: don't strip decimal zeros, causing misparsing (fix #1137) 2019-11-30 16:58:54 -08:00
Simon Michael
8b4ae4cd43 ;csv: another commented test for auto-generation of balancing posting
and remove some junk.

[ci skip]
2019-11-23 12:54:34 -08:00
Simon Michael
464983f99a ;csv: add some commented tests for #1111/#1133
[ci skip]
2019-11-23 12:26:22 -08:00
Dmitry Astapov
aa051a05cf lib: support generation of (un)balanced virtual postings in csv reader 2019-11-23 10:28:10 -08:00
Mykola Orliuk
6dbe925eed cli: anonymize transaction code also 2019-11-18 17:42:22 -08:00
Mykola Orliuk
0a273561f7 cli: anonymize declared accounts also
Fixes simonmichael/hledger#901
2019-11-18 17:42:22 -08:00
Michael Kainer
79ca4a767e cli: Add -% to compound balance commands
This commit introduces the commandline argument -%/--percent to show
percentages of the column's total instead of the absolute amounts for
each account in reports. The signs of the values are preserved.

This option is especially useful for the balance and incomestatement
commands.

If there are multiple commodities involved in a report hledger bails
with an error message. This can be avoided by using --cost. Also note
that if one uses -% with the balance command the chances are high that
all numbers are 0. This is due to the fact that by default balance sums
up to zero. If one wants to use -% in a meaningful way with balance one
has to add a query.

In order to keep the implementation as simple as possible --tree has no
influence over how the percentages are calculated, i.e., the percentages
always represent the fraction of the columns total. If one wants to know
the percentages relative to a parent account, one has to use a query to
narrow down the accounts.
2019-11-18 17:10:59 -08:00
Dmitry Astapov
87b82b6839 lib: roi does not fail on empty input data (+test) 2019-11-18 16:13:04 -08:00
Dmitry Astapov
e49da20f8c test: balance-style -> balance-type 2019-11-13 09:06:25 -08:00
Dmitry Astapov
39bc183340 lib: csv reader gets balance-style directive 2019-11-13 09:06:25 -08:00
Simon Michael
c4d7cc198a csv: finalise and check journals generated from CSV (#1000)
Invalid transactions generated from CSV will now be rejected.
I updated some csv tests to avoid this, except for 21, which
probably needs more cleanup.
2019-11-07 18:58:12 -08:00
Dmitry Astapov
fb5bca0b46 test: update csv tests for expenses:unknown being new default 2019-11-05 22:10:41 +00:00
Dmitry Astapov
c66ccc5cee lib: do not try to balance transaction in csv reader 2019-11-05 21:16:42 +00:00
Dmitry Astapov
95ec5715cc lib: better compatibility code in csv reader 2019-11-05 21:16:42 +00:00
Dmitry Astapov
d62f84bec2 lib: csv reader does not generate postings if account="" 2019-11-05 21:16:42 +00:00
Dmitry Astapov
8d24a40150 lib: csv parser fills out amounts on all postings, if possible 2019-11-05 21:16:42 +00:00