Commit graph

650 commits

Author SHA1 Message Date
John Wiegley
5d02402291
Merge remote-tracking branch 'origin/master' into next 2018-07-19 22:01:31 -07:00
Pascal Fleury
3ee62bf84e Add the test to make sure it works in the future. 2018-07-18 00:08:56 +02:00
Christoph Dittmann
86a23cd263 Remove TOK_A_YEAR token
This fixes #1626.

The tokenizer eagerly classifies 4-digit integers as TOK_A_YEAR
tokens.  In some contexts such as "every 1000 years", this causes
errors.

I think the tokenizer does not have enough information available to
distinguish between integers and years.

After this patch, the tokenizer will always classify integers as
TOK_INT tokens.  The "has 4 digits" heuristic to determine if an
integer is a year is moved to the place where it's actually
needed (and it can be slightly more generic there, too).
2018-06-10 13:55:17 +01:00
Christoph Dittmann
6853464fd0 Make automated transactions work with assertions
This fixes issue #1127.  In my understanding, PR #552 was meant to fix
this, but was incomplete.

Without this patch, automated transactions are invisible to
assertions.

This patch fixes this by adding a flag to the account to tell it that
there is a new posting, analogous to the behavior of finalize().

I dug up issue #1127 too late to find that this is the same solution
proposed by @tbm.  Although I wrote this independently, credit goes to
Martin Michlmayr (@tbm).
2018-06-09 23:47:49 +01:00
smr894
48edf1eb5c budget_posts: Keep pending items until the last day they apply 2018-04-04 23:30:38 -04:00
John Wiegley
b7b0280066
Merge pull request #519 from mbudde/accounts-prepend-format
Add support for --prepend-format in accounts command
2018-01-27 00:42:39 -08:00
Alexis Hildebrandt
1be23f1653
Merge pull request #521 from mbudde/fix-trim
Fix handling of edge cases in trim function
2018-01-27 15:55:08 +08:00
Alexis Hildebrandt
c6c328c011 [misc] Update year in copyright notice to 2017
[ci skip]
2018-01-27 15:30:53 +08:00
Michael Budde
1070c17f8c Fix handling of edge cases in trim function
Fixes #520
2018-01-25 21:14:10 +01:00
Michael Budde
6b998aee10 Add support for --prepend-format in accounts command
Add support for the `--prepend-format` and `--prepend-width` options in
the `accounts` command.
2018-01-25 19:27:24 +01:00
Michael Budde
c0ad7e34fa Fix segfault when using --market with --group-by
`changed_value_posts::create_accounts()` reuses the `<Revalued>` account
from `display_filter`, but when clearing `changed_value_posts`
`create_accounts()` would be called before the account had been
recreated by `display_filter_posts`. This results in a segfault when
using the --group-by option.

I'm not sure if `display_filter_posts` has the same problem but I
reordered the calls there too for good measure.
2018-01-04 18:29:48 +01:00
John Wiegley
a8a9c1a528 Merge pull request #494 from jjlee/fix-total
Fix bug where .total used in value exprs breaks totals
2017-10-26 21:04:00 -07:00
John Wiegley
87105d432b Merge pull request #484 from mk12/bug-1182-ptr
Fix Bug 1182: Error message for parse failure after '='
2017-10-26 15:20:51 -07:00
John Lee
de1b48a013 Fix bug where .total used in value exprs breaks totals
* Re-initialize (to VOID) totals for the account and its ancestors on adding
  postings.  Otherwise the cache intended for use by recursive calls of C++
  function total() in computing family (i.e. account hierarchy) totals is
  incorrectly retained from one top-level call to the next, causing
  inconsistent and broken behaviour.

* Re-initialize (to false) calculated and gathered.  Otherwise we won't
  e.g. recalculate stale totals for ancestor accounts (e.g. won't recalculate
  Assets:Savings total if Assets:Savings changes via a posting).

Although the value expression total function is used by ledger itself in
computing totals, this bug would only appear on use of .total in user-supplied
value expressions computed *during parsing* of ledger files, rather than after
parsing (I believe ledger only ever calls it for internal purposes after
parsing is complete).

It is possible this bug also affected other functions than total (perhaps even
in circumstances other than analagous to that described in the preceding
paragraph).  I have not checked that.
2017-10-26 22:35:24 +01:00
Alexander Pletnev
9faed90dc2 typo in docs
fix test
2017-01-27 22:07:01 +03:00
thdox
aa6c214e8d Merge pull request #477 from thdox/bug-584-550
Add regress test for bugs 550 and 584
2017-01-16 18:54:34 +01:00
thdox
65eda1b048 Merge pull request #476 from thdox/bug-1055
Add regress test for bug 1055
2017-01-16 18:53:53 +01:00
thdox
58af4cfb4a Add regress test for bugs 550 and 584 2017-01-05 20:16:17 +01:00
thdox
1f7ce7c7c1 Add regress test for bug 1132 2017-01-05 20:16:04 +01:00
thdox
59d0da6004 Add regress test for bug 1055 2017-01-05 20:15:56 +01:00
Alexis Hildebrandt
9432937f5c [misc] Update year in copyright notice to 2017
[ci skip]
2017-01-05 12:56:35 +01:00
Mitchell Kember
1c93a7355f Print error message if parsing predicate after '=' 2016-12-20 17:30:25 -05:00
John Wiegley
e24315d22a
Don't explicitly reference test file in 1057.test 2016-11-13 12:16:29 -08:00
Martin Michlmayr
b6392fa40f Update cmd-tags.test for fix for bug #1043 2016-11-12 18:57:21 -08:00
thdox
5b70d4e5e4 Add test for --color option 2016-10-27 22:05:49 +02:00
thdox
cc59fa9efe Add another test to opt-force-color.test
To verify that no ANSI color codes are printed when the --force-color
option is not set.
2016-10-27 22:05:49 +02:00
thdox
b3174a8ff9 --force-color is now tested in CheckBaselinetests.py 2016-10-27 22:05:49 +02:00
thdox
0fce4e831e --force-color does not require anymore --color.
This was reported as Bug #1109
2016-10-27 22:05:49 +02:00
Mitchell Kember
d541cceaf7 Fix bug 1187: Allow balance assertions with multiple posts to same account 2016-10-07 20:25:20 -07:00
John Wiegley
3ebe330bf1 Merge pull request #469 from schmave/win-383
Fix regress test 383 on Windows
2016-10-02 22:49:18 -07:00
Evan Mallory
94c0db0133 Fix regress test 383 on Windows
%g is not available in Windows strftime. See documentation at https://msdn.microsoft.com/en-us/library/fe06s4ak.aspx
2016-10-02 20:02:24 -04:00
John Wiegley
ca9877ff41 Merge pull request #468 from Vanav/cygwin_fix
Fix build under Cygwin
2016-10-02 10:32:25 -07:00
Ivan Vanyushkin
c278559083 Fix build under Cygwin. 2016-09-29 21:46:45 +03:00
Evan Mallory
0e691e76db Fix test harness to work with msys2
With this change, 97% of the tests pass. See the build on appveyor for more info: https://ci.appveyor.com/project/Evan/ledger/build/build-49

I'll follow up with another PR to fix some of the remaining broken tests
2016-09-23 08:14:30 -04:00
Evan Mallory
c193cc3a5b Fix build under msys32; add Appveyor continuous build
* Appveyor is a continuous integration platform for Windows that is free for open source projects. See latest test build here: https://ci.appveyor.com/project/Evan/ledger/build/artifacts

* Changed WIN32 to _WIN32 because this article http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system claims that it is defined by the greatest number of compilers.

* Modified HAVE_ISATTY and other system defines so that system.hh compiles when cmake fails to find the relevant function.

* Add missing include in test/unit/t_value.cc

Almost all tests fail when you run them on msys32. I will address that in a future PR.
2016-09-17 14:22:38 -04:00
Mitchell Kember
d082b6485f Fix Bug 1147: Check balance assertions against the amount AFTER 2016-03-22 23:09:27 -07:00
John Wiegley
16c2b8d58d Merge pull request #449 from ppickfor/next
Use interval start date (period from/since) to initialize first period.
2016-03-14 12:03:24 -07:00
Peter Pickford
a0b68905ef days - do not stabalize periods spacified in days
weeks - calculate start date for finding period using remainer 400/periodlength to reduce number of iterations (perhaps this ought to follow the same conventio as years months and quarters)

add sample period command tests
add add day period tests for forecasts and budgets
add week period tests for forecasts and budgets - these do not change
2016-03-13 17:19:46 -07:00
Peter Pickford
97ec24544e Periods should be initialized from from/since clause rather than earliest transaction date
Bug 1159

Use interval start date (period from/since) to initialize first period.

This allows the offset of a period start to be specified

-p 'every 12 months from 2000-04-01'

will have periods

yyyy-04-01 to yyyy-03-31
....

If no from/since is specified for the period the first transaction date reported is used to initialize the period as before.

added test case regress/1159.test
2016-03-09 16:00:10 -08:00
Martin Michlmayr
b7f84d6900 Fix test suite failure
I'm sure I used $FILE for the final version but I must have committed
an old version.
2016-02-16 12:22:50 -08:00
Martin Michlmayr
c5f68caa9e Increase maximum length for regex
Fixes bug #981
2016-02-15 13:58:18 -08:00
Manuel Amador (Rudd-O)
d300dfefec Add parse error test 2016-02-08 04:58:01 +00:00
Alexis Hildebrandt
0bbb4f2f0c [python] Remove double quotes from unicode values
When converting a ledger.Value to unicode the Python API added
double quotes around it.
2016-01-11 21:38:32 +01:00
Alexis Hildebrandt
9892878ca1 [misc] Update year in copyright notice to 2016
[ci skip]
2016-01-02 12:09:54 +01:00
Martin Michlmayr
7eacf51308 Always use plurar Expenses: for consistency 2015-12-14 13:54:16 -08:00
Alexis Hildebrandt
d97b834107 [tests] Fix empty testfile check 2015-10-27 18:16:24 +01:00
Alexis Hildebrandt
32eca73479 [tests] Remove compiler warnings for unit tests
warning: equality comparison result unused [-Wunused-comparison]
  BOOST_CHECK_THROW(v8 == v10, value_error);
                    ~~~^~~~~~
2015-09-15 16:34:59 +02:00
thdox
b91b74fc43 Rename feat-fixated-prices_2.test to dir-fixed.test
For consistency as this is a directive.
2015-08-08 11:59:28 +02:00
Alexis Hildebrandt
64b285d583 [tests] Fix MathTest failures on Mac OS X
due to timezone settings.
2015-08-08 00:55:19 +02:00
Alexis Hildebrandt
fe410fa239 [tests] Set timezone for running tests
so that the tests run with a consistent environment.
2015-08-07 19:42:23 +02:00