Simon Michael
1a38beaad1
drop old transactionp hunit tests
2018-08-19 19:12:26 +01:00
Simon Michael
7706f8498e
tests: comment
2018-08-19 19:05:59 +01:00
Simon Michael
89357bb7b6
another parse test helper, use the IO variant always, port more tests
2018-08-19 19:02:59 +01:00
Simon Michael
2778f6cf8f
lib: restore some old unit tests
...
Also change nullsourcepos, tests prefer JournalSourcePos for some reason.
2018-08-19 18:13:01 +01:00
Simon Michael
bdcfba4eaa
whitespace
2018-08-18 20:31:47 +01:00
Simon Michael
fc11b5130f
journal: another failing test from #807
2018-08-18 19:50:15 +01:00
Simon Michael
d778a92561
tests: export HUnit/EasyTest from Hledger.Utils.Test; more helpers
2018-08-18 15:19:59 +01:00
Simon Michael
e0e21a2c6c
lib: note
2018-08-18 07:30:23 +01:00
Simon Michael
9c3a57f615
lib: some test fixes ( #823 )
2018-08-17 14:18:24 +01:00
Simon Michael
b4c336c874
test/_test/it/_it helpers; refactor easytests
...
This makes skipping/unskipping tests easier, and improves readability
a bit.
Note it's also possible to just write the test name with no preceding
function, when the type is constrained (see Journal.hs).
2018-08-17 13:40:37 +01:00
Simon Michael
626247bacd
journal: unit tests (2 skipped) for periodtransactionp ( #823 )
2018-08-17 12:42:43 +01:00
Simon Michael
1d775a7a9c
lib: D should not affect automated posting multiplier amounts ( fix #860 )
2018-08-17 07:39:17 +01:00
Simon Michael
13436637c6
lib: "decimal point" -> "decimal separator" in error message
2018-08-17 07:37:26 +01:00
Simon Michael
e35dd19cc8
lib: refactor: tighten up amountwithoutpricep
2018-08-17 06:51:07 +01:00
Simon Michael
e9c5d13ac1
lib: update old failing amountp/postingp tests, at last ( #812 )
2018-08-16 06:42:52 +01:00
Simon Michael
09d8e302db
lib: use unspaced scopes to simplify command lines ( #812 )
2018-08-16 05:58:17 +01:00
Simon Michael
50d666d5a0
test: refactor, document, organise easytests, port amountp tests ( #812 )
2018-08-15 19:58:07 +01:00
Simon Michael
69325da110
comment out failing tests to fix CI ( #812 )
2018-08-15 11:30:53 +01:00
Simon Michael
ab7dc3294e
lib: more informative failure output for amount tests ( #812 )
2018-08-15 11:24:52 +01:00
Simon Michael
e077aeff5f
lib: more informative test failure message ( #812 )
2018-08-14 16:05:06 +01:00
Simon Michael
321635274c
lib: move assertParseEqual' ( #812 )
2018-08-14 16:05:06 +01:00
Simon Michael
b03584dbce
lib: parse helper haddocks
2018-08-14 16:05:06 +01:00
Simon Michael
cfaa0501e6
lib: update some journal parser tests ( #812 )
2018-08-14 16:05:06 +01:00
Jakub Zárybnický
c67404c73d
lib: Fix compile errors in tests
2018-08-14 16:05:06 +01:00
Simon Michael
e88a9c4a5f
lib: followingcomment: parse no comment as "", not "\n"
...
Same-line & next-line comments of transactions, postings, etc.
are now parsed a bit more precisely. Previously parsing no comment
gave the same result as an empty comment (a single newline); now
it gives an empty string.
Also, and perhaps as a consequence of the above, when there's no
same-line comment but there is a next-line comment, we'll insert an
empty first line, otherwise next-line comments would get moved up to
the same line when rendered.
Some doctests have been added.
2018-08-03 19:38:55 +01:00
Joseph Weston
40d70ad10b
lib: fail when file to include is in stack of 'include' files
2018-08-02 18:43:00 +01:00
Joseph Weston
1d91ea43a5
lib: add whitespace around '$' operator
2018-08-02 18:43:00 +01:00
Simon Michael
d685d1aa9b
lib,rewrite: simplify transactionModifierToFunction
...
This removes transactionModifierToFunction's extra query parameter;
the rewrite command sets it in the TransactionModifier instead, which
I think is equivalent. I had to change one functional test, but it
seems correct now, so perhaps it wasn't working right before ?
2018-08-02 08:25:49 +01:00
Simon Michael
eae9d78bb1
lib: generateAutomaticPostings -> applyTransactionModifiers
2018-08-02 08:25:49 +01:00
Simon Michael
bb36693155
lib: refactor, txnTieKnot automatically
2018-08-02 08:25:49 +01:00
Simon Michael
572f5a4b31
lib: drop parseAndFinaliseJournal', seems unused (api change)
2018-08-02 08:25:49 +01:00
Simon Michael
efc54c4c25
lib: ModifierTransaction -> TransactionModifier; try to clarify a bit
2018-07-30 19:38:21 +01:00
Simon Michael
d9d94e2cf6
journal: fix breakage in auto posting rule parser ( #745 )
...
I was negligent and did not test enough. This should ignore
transaction comments in auto posting rules more safely.
It also adds support for trailing comments on the first line of auto
posting rules, which previously were misparsed as part of the query.
2018-07-26 15:54:21 +01:00
Simon Michael
e2f5e98926
lib: clarify account name parsing rules
2018-07-26 08:30:32 +01:00
Simon Michael
41c985b5fb
journal: ignore transaction comments in auto posting rules ( #745 )
...
Previously they were misparsed as account names.
2018-07-26 08:29:02 +01:00
Joseph Weston
f2c1586238
lib: sort the matched include files lexicographically
...
Now the files are included in the same order as they would be
listed by 'ls'.
2018-07-26 06:12:31 +01:00
Joseph Weston
1ec16c2dc0
lib: explicitly specify that the 'Glob' package should be used
...
Without this there are conflicts with the 'filemanip' package,
which itself exports a module 'System.FilePath.Glob'.
2018-07-26 06:12:31 +01:00
Joseph Weston
c69b16d826
lib: prefer use of 'parseErrorAt' to generic 'fail'
...
'fail' will just terminate the current parse branch, whereas here
we have encountered a definite error. Also bring the code to
get the current working directory inside 'getFilePaths', as it
logically belongs there.
2018-07-26 06:12:31 +01:00
Joseph Weston
5077443a84
lib: add tests and code for nonexistant files and malformed globs
2018-07-26 06:12:31 +01:00
Joseph Weston
2c4d0c0acd
lib: factor out logic for obtaining a list of files to include
2018-07-26 06:12:31 +01:00
Joseph Weston
0ade323d2a
lib: use glob matching if filename in 'include' directive is a glob pattern
2018-07-26 06:12:31 +01:00
Joseph Weston
96f7a03487
lib: factor out parsing child journal into separate function
2018-07-26 06:12:31 +01:00
Joseph Weston
52da073828
lib: expand current directory separately from filepath
...
We will need the current directory as an absolute path when
adding glob patterns in a few commits time.
2018-07-26 06:12:31 +01:00
Joseph Weston
9e56ad24e2
lib: reorder code for reading include files
...
This should be before all journal and parser state manipulations,
so that those can be readily factored in a few commits time.
2018-07-26 06:12:31 +01:00
Simon Michael
fe73f2a6b5
csv: interpolated field names in values are now case insensitive
...
Field names are supposed to be case insensitive, but a field assignment like
fields ...,Transaction_Date,...
date %Transaction_Date
was failing, because of the capitalised letters. Fixed now.
2018-07-22 22:26:24 +01:00
Simon Michael
d5430e7ddf
clean up debug helpers (api change)
2018-07-16 15:28:58 +01:00
Simon Michael
6924e8390c
lib: journal: let alias/apply account affect account directives ( #825 )
2018-06-27 11:33:12 +01:00
Alex Chen
e82b01bcf8
lib: refine parse errors and parser labels
2018-06-20 23:24:39 -06:00
Alex Chen
9674f2a8cc
lib: tweak whitespace parsing for better parse errors
...
- expands the set of expected tokens when e.g. parsing the invalid
posting `account $1 a`
- whitespace can affect parse errors because of the longest match rule
where errors that occur later take precedence over those that occur
earlier
2018-06-20 23:24:39 -06:00
Alex Chen
ed0106b209
lib: reduce backtracking of various parsers
2018-06-20 23:24:39 -06:00