| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
| |
This adds a new item flag, `ITEM_INFERRED`, that differentiates
generated items from bucket items. This makes them show up as
related items in reports.
|
|
|
|
|
| |
Bugs #777 and #2207 were fixed by commit 49cf3323a ("Change a use of
is_realzero to just is_zero"). Let's add test cases.
|
| |
|
| |
|
|
|
|
| |
[skip ci]
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Setters for types wrapped in boost::optional, such as item_t::note were
broken, e.g. setting a note on a transaction resulted in garbled data
that would cause Python to throw utf-8 errors when retrieving the note.
(But setters that accessed strings directly, e.g. "payee" on a transaction
worked fine.)
This change alters the from-python conversion for optional-wrapped
types based on the example at
https://stackoverflow.com/questions/36485840/wrap-boostoptional-using-boostpython
and a test case to verify the behavior.
|
|
|
|
|
|
|
| |
Ledger's expression parser considers quoted_rfc4180 to be an
amount (quantity 4180 of commodity "quoted_rfc").
Fixes #2007.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
1. Remove references to modules (exceptions, StringIO) no longer needed for Pythn3
2. Use assertEqual instead of assertEquals
3. Clear journal files with a close_journal_files() function that uses the then-current underlying python_session pointer. Calling session.close_journal_files() sometimes leads to segfaults because python_session has changed after it was injected into the python module (as "session") on module startup.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
to fix failing tests on Darwin, where /tmp is a symlink to /private/tmp
and the tests fail as ledger reports filenames with the symlink resolved
to /private/tmp, but the tests expect files with /tmp.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In `compare_items` if `sort_order` is a top level expression, it has
no context and `get_context()` method returns the null pointer. To see
this, run
$ ledger -f test/input/demo.ledger --sort display_amount reg --debug scope.symbols
and there will be many lines like
[DEBUG] Binding scope 0 with ...
In such case making a reference to the context is an undefined
behavior (honestly the dereferencing itself feels quite problematic,
but many compilers just run without any complaints) and could
potentially cause segfaults.
Therefore, we change to use only the grandchild scope (`left` or
`right`) for `find_sort_values` here. Note that it may seem to be more
appropriate to use `report` here for the parent scope. However, in
`find_sort_values` which is called right after, the `report` scope is
always bound to this scope. So we only use grandchild scope to avoid
unnecessary operations.
Fixes #2069.
|
|
|
|
|
|
|
| |
Here `comm` could be a null pointer (the new test regress/2057 shows
such a case). So test it before dereferencing to avoid segfault.
Re: #2057
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ensure the path of file to include in `instance_t::include_directive`
is always an absolute path.
Previously when the journal file is given through stdin, we prepend a
"./" to the filename to include. However, in Boost >= 1.77,
`path::normalize` strips the leading "./" [1]. Our `resolve_path`
function calls `normalize` and thus now it returns "file" for "./file"
instead of the previous "./file".
This change causes a failing test regress/BF3C1F82-2 [2], and also
breaks the `include` directive for stdin input:
$ touch file-to-include
$ echo "include file-to-include" | ledger -f - reg
gives
While parsing file "", line 1:
Error: File to include was not found: "file-to-include"
Therefore, we change to prepend the `context.current_directory` to
make the filename absolute in this case as well. The test
regress/BF3C1F82-2 is also updated to match the new output.
Fixes #2075.
[1] https://github.com/boostorg/filesystem/commit/16bd89b7c0398d0dc5904148a865ef3fc3ece7ec
[2] https://github.com/ledger/ledger/issues/2075
|
|
|
|
| |
A better fix for this issue is needed, however.
|
|
|
|
|
|
|
|
| |
This makes it safe to compare results to -1 to indicate EOF,
regardless of whether char is considered signed or unsigned;
and so eliminates compiler warnings on platforms such as ARM.
Fixes bug #2058.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While the current formula works for positive numbers, negative numbers
are incorrectly represented.
One of the issues comes from the fact that floor(x) < x for every x.
`amount_t precision` will always be a non negative number and the code
that attempts to fix the issue for negative number will never run.
If we truncate the number instead, the current formula works for both
positive and negative numbers without making negative numbers a corner
case. So let's do that.
Signed-off-by: Rafael Ascensão <rafa.almas@gmail.com>
|
| |
|
|
|
|
|
|
|
|
| |
Handle files that don't end with a new line. Throw an error when the buffer
size is exceeded.
Fixes #516
Contributes to #1149
|
|
|
|
| |
Fixes #2023.
|
|
|
|
|
| |
An amount may have a (single) leading minus sign, but none after that.
Bug #2001 (and #1809).
|
|
|
|
| |
Also fix end-of-command boundary checks for keywords "at", "to", etc.
|
|
|
|
|
| |
Windows doesn't seem to use UTF-8 by default, so we can specify
encoding='utf-8'. Also, backslashes are confusing to regex parsers.
|
|
|
|
| |
Date format %F is not available on all platforms.
|
|
|
|
|
| |
Payees declared on posting's metadata are now validated with `--check-payees`
option. Also, their aliases are now considered on reports as well.
|
|
|
|
|
| |
This changes the error reported when a transaction with no amount is
imported.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit 501fbc08ae5493db77bb34f4c4fbe1f3a3bc14e3 changed the behavior
of this function to not return the "equal" result (==0) from the
recursive call. Previously, the function returned the result of the
recursive call unconditionally.
The current behavior causes an assertion error for certain
postings. The regression test added in this commit shows such a
posting.
I found through Travis CI that the old behavior was incomplete and
caused unstable orderings, so reverting to the old behavior doesn't
work. Instead, this change adds a fallback: If the recursive call that
compares the prices numerically returns "equal", then compare the
prices with their original commodity as a tie breaker.
This commit does not change any existing ordering, it only adds
deterministic ordering in a case that currently triggers an assertion
error.
This fixes issue #1998.
|
|
|
|
| |
also add unit tests
|
|
|
|
|
|
|
|
|
|
|
| |
Ledger is treating balance assignments that have a 0 diff as having
a null posting, leading to the posting being auto-balanced and
therefore causing incorrect values to be returned for the transaction.
I fixed this by just making the posting equal to amt - amt (0 in the
right commodity).
Fixes #1942
|
|
|
|
|
|
|
|
|
|
| |
Commit 557ab32 ("Expose a new utility function for balances:
sorted_amounts") split out some code into a separate function.
Unfortunately, in the process an "if" statement was dropped,
leading to amounts being shown that shouldn't be shown because
they are smaller than the display precision.
Fixes #1969
|
|
|
|
|
|
|
|
| |
Commit 92b6072ffd ("run demo.py with ctest") made demo.py part
of the test suite. But we can only run it if Python is enabled
in ledger.
Fixes #1910
|
|
|
|
| |
Thanks to Feiko Nanninga for the test case.
|
|
|
|
|
| |
Fix error from newer cmake/FindPython versions not printing internal
Python_EXECUTABLE variable.
|
| |
|
|
|
|
|
|
| |
Add tests for wrong behavior caused by commit 49b07a1c1948 ("Correction
to the way parens are parsed in query expressions") which was reverted
with commit 869302ae9ce3. The bug report was issue #1894.
|
|
|
|
|
|
|
|
| |
The directive `apply account` and similar directives (fixed, year...)
require an argument. Ensure that an argument is given.
Fixes #553
Fixes #1854
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Without these changes, whether an account's balance is virtual
or real is not considered when asserting it's balance. This lead
to situations where the user must consider their virtual postings
when attemping to assert the real balance of the account. See
test/regress/543_a.test for that testcase, taken from the original
issue. This commit also includes other, fringe, situations that I
noticed while working on the fix. It essentially just adds a separate
attribute to the account class(?) that hold's the account's "real"
balance, which is only updated when the user attempts an assertion on a
real account. The virtual account's balance is updated the way it always
was.
|
|
|
|
| |
Fixes #1877
|