Commit Graph

595 Commits

Author SHA1 Message Date
Simon Michael
84165f5a0c ;journal: fix tests 2020-03-17 17:48:17 -07:00
Simon Michael
a1361ecc04 csv: don't force a second posting with amount1
A rewrite and simplification of the posting-generating code. The
"special handling for pre 1.17 rules" should now be less noticeable.
amount1/amount2 no longer force a second posting or explicit amounts
on both postings. (Only amount/amount-in/amount-out do that.)
Error messages and handling of corner cases may be more robust, also.
2020-03-16 16:18:58 -07:00
Simon Michael
7564963a62 ;csv: tests documenting some current surprises 2020-03-10 15:01:55 -07:00
Simon Michael
ababccd8e0 ;tests: rename hledger-csv -> csvtest.sh 2020-03-09 15:13:37 -07:00
Simon Michael
52da3853c0 ;tests: fix csv func tests on mac with default awk 2020-03-07 13:59:53 -08:00
Simon Michael
21fdcec6b7 journal: inclusive balance assignments now work (#1207) 2020-03-05 13:38:19 -08:00
Simon Michael
41bb7865f3 ;convert balance assertion/assignment tests to new format
And update a seemingly obsolete test description.

[ci skip]
2020-03-05 11:19:21 -08:00
Simon Michael
f18c74fff7 ;journal: a test for inclusive balance assignment, disabled (#1207)
[ci skip]
2020-03-05 11:19:04 -08:00
Simon Michael
b1f3880c3d lib: drop the file format auto-detection feature
For a long time hledger has auto-detected the file format when it's
not known, eg when reading from a file with unusual extension (like
.dat or .txt), or from standard input (-f-), or when using the include
directive (which currently ignores file extensions).

Auto-detecting has been done by trying all readers until one succeeds.
This could guess wrong in some cases, but it was so rare that it has
been working fine.

Recently, more conveniences have been added to timedot format,
increasing its overlap with journal format, which makes this kind of
auto-detection unreliable.

Auto-detection and auto-detection failures are (probably) still pretty
rare in practice. But when it does happen it's confusing, giving
misleading errors or false successes (eg printing timedot entries
instead of a journal error).

For predictability and to minimise confusion, hledger no longer tries
to guess; when there's no file extension or reader prefix, it assumes
journal format. To specify one of the other formats, you must use a
standard file extension (.timeclock, .timedot, .csv, .ssv, .tsv), or a
reader prefix (-f csv:foo.txt, -f timedot:-).

For now, the include directive still tries to autodetect
(journal/timeclock/timedot), and this can't be overridden; it will be
fixed later.

Experimental; testing and feedback welcome.
2020-03-01 14:06:29 -08:00
Simon Michael
190233b576 timedot: more org support: dates/entries can be org headlines
Org headline prefixes (stars and space at beginning of line) are ignored.
2020-03-01 14:06:29 -08:00
Simon Michael
cc928c0096 ;timedot: a functional test 2020-02-27 17:38:13 -08:00
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