Simon Michael
9c0483fef2
tests: port another to easytest
2018-08-20 08:22:31 +01:00
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
13436637c6
lib: "decimal point" -> "decimal separator" in error message
2018-08-17 07:37:26 +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
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
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
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
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
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
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
e3a755b5b1
lib: refactor amount parsers to minimize backtracking
...
- inline `spaceamountormissingp` into `postingp`
- combine `rightsymbolamountp` and `nosymbolamountp`
- the multiplier symbol '*' for an amount must now always preceed a sign '-'
[breaking change]
- make amount parser labels more generic to simplify error messages
2018-06-20 23:24:39 -06:00
Simon Michael
c4d45cffc4
lib: journal: require a space between period expr. and other fields
2018-06-12 16:41:36 -07:00
Alex Chen
c6bfd92dd3
removing "re-parsing" for pull 807
...
For Data/Dates.hs in particular:
- Changed `SimpleTextParser` to `TextParser m` for all parsers
- Changed `string` to the case-insensitive `string'` to match the
behaviour of `T.toLower` found in `parsePeriodExpr`
- export `periodexprp` for "direct" use
2018-06-12 16:41:36 -07:00
Simon Michael
e3507ad944
lib: journal: allow descriptions/comments in periodic transactions
...
Also period expressions relative to today's date can now be used,
for what it's worth.
2018-06-12 16:41:36 -07:00
Simon Michael
dfcafc2cdf
lib: refactor some journal, period expression parsers
2018-06-12 16:41:36 -07:00
Alex Chen
0fb737bc39
lib: reduce backtracking in commoditydirectiveonelinep
2018-06-11 14:29:18 -06:00
Alex Chen
0382bb5cd4
lib: move custom parse errors to Text.Megaparsec.Custom
2018-06-11 13:58:56 -06:00
Alex Chen
ff2b042c7e
lib: remove the ErroringJournalParser
type
2018-06-11 13:58:56 -06:00
Alex Chen
2d21ec0174
lib: weaken parser types
2018-06-11 13:57:30 -06:00
Alex Chen
4a9e418b7a
lib: refactor includedirectivep
to avoid "re-parsing"
2018-06-11 13:57:30 -06:00
Alex Chen
b034fa7ca9
lib: weaken parser types
2018-06-11 13:57:30 -06:00
Alex Chen
9b6558401f
lib: rewrite comment parsers [API]
...
- avoid the "re-parsing" of comments using the `match` parser combinator
2018-06-11 13:57:30 -06:00
Alex Chen
d707b351cc
lib: switch to custom parse errors for parserErrorAt
...
Also weaken the types of the parsers that use it
2018-06-11 13:57:30 -06:00
Alex Chen
c5561f25f1
lib: switch parsers to the custom error type
...
Also add an explicit export list to `hledger-lib/Hledger/Utils/Parse.hs`
in order to re-export the custom error type (for convenience).
2018-06-11 13:57:30 -06:00
Simon Michael
0ce9c5728a
switch to base-compat-batteries to fix ghc 7.10 support ( #794 )
...
base-compat-batteries provides the same API across more ghc versions
than base-compat does, at the cost of more dependencies. Eg it exports
Prelude.Compat ((<>)) with ghc 7.10/base 4.8, which we expect.
My belief is that several of our deps already require it so the added
cost is not too great. We should probably go back to base-compat when
possible though, eg when we stop supporting ghc 7.10.
2018-06-04 17:32:42 -07:00