diff options
author | John Wiegley <johnw@newartisans.com> | 2012-03-16 04:09:21 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2012-03-16 04:09:21 -0500 |
commit | 7462d09b214f2497d9d41a24f4fa8a4dd1577aba (patch) | |
tree | 639ef9fe4dea88d815a35efacbc0c120cba78648 | |
parent | 20c076dff92806c6c2aae7c0c87b000ffc703382 (diff) | |
download | fork-ledger-7462d09b214f2497d9d41a24f4fa8a4dd1577aba.tar.gz fork-ledger-7462d09b214f2497d9d41a24f4fa8a4dd1577aba.tar.bz2 fork-ledger-7462d09b214f2497d9d41a24f4fa8a4dd1577aba.zip |
Correct parsing of automated xact expressions
Fixes #458
-rw-r--r-- | lisp/ldg-test.el | 3 | ||||
-rw-r--r-- | src/query.cc | 2 | ||||
-rw-r--r-- | test/regress/605A410D.test | 32 |
3 files changed, 35 insertions, 2 deletions
diff --git a/lisp/ldg-test.el b/lisp/ldg-test.el index ad612f4d..77e03026 100644 --- a/lisp/ldg-test.el +++ b/lisp/ldg-test.el @@ -57,7 +57,8 @@ (goto-char (point-min)) (when (re-search-forward "^test \\(.+?\\)\\( ->.*\\)?$" nil t) (let ((command (expand-file-name ledger-test-binary)) - (args (format "-f \"%s\" %s" buffer-file-name (match-string 1)))) + (args (format "--args-only --columns=80 --no-color -f \"%s\" %s" + buffer-file-name (match-string 1)))) (setq args (replace-regexp-in-string "\\$sourcepath" ledger-source-directory args)) (kill-new args) diff --git a/src/query.cc b/src/query.cc index 8bdabb38..3fec708a 100644 --- a/src/query.cc +++ b/src/query.cc @@ -146,7 +146,7 @@ query_t::lexer_t::next_token(query_t::lexer_t::token_t::kind_t tok_context) case '\t': case '\n': case '\r': - if (! multiple_args && ! consume_whitespace) + if (! multiple_args && ! consume_whitespace && ! consume_next_arg) goto test_ident; else ident.push_back(*arg_i); diff --git a/test/regress/605A410D.test b/test/regress/605A410D.test new file mode 100644 index 00000000..6943939a --- /dev/null +++ b/test/regress/605A410D.test @@ -0,0 +1,32 @@ += expr amount > 500 and account =~ /Employer:One/ + (Virtual) 1 + +2012-01-16 KFC + Employer:One $1,000.00 + Assets:Cash + += expr amount>500 and account =~ /Employer:Two/ + (Virtual) 10 + +2012-02-16 KFC + Employer:Two $1,000.00 + Assets:Cash + += Employer:Three and expr amount>500 + (Virtual) 100 + +2012-03-16 KFC + Employer:Three $1,000.00 + Assets:Cash + +test reg +12-Jan-16 KFC Employer:One $1,000.00 $1,000.00 + Assets:Cash $-1,000.00 0 + (Virtual) $1,000.00 $1,000.00 +12-Feb-16 KFC Employer:Two $1,000.00 $2,000.00 + Assets:Cash $-1,000.00 $1,000.00 + (Virtual) $10,000.00 $11,000.00 +12-Mar-16 KFC Employer:Three $1,000.00 $12,000.00 + Assets:Cash $-1,000.00 $11,000.00 + (Virtual) $100,000.00 $111,000.00 +end test |