This commit is contained in:
Craig Earls 2014-05-18 08:25:30 -07:00
commit 8e6cdcc1d1
24 changed files with 167 additions and 104 deletions

28
.gitignore vendored
View file

@ -1,4 +1,6 @@
*.[oa] *.[oa]
*.so
*.so.*
*.backup *.backup
*.elc *.elc
*.gcov *.gcov
@ -11,12 +13,9 @@
.deps/ .deps/
.libs/ .libs/
ABOUT-NLS ABOUT-NLS
BaselineTests
Makefile Makefile
Makefile.am Makefile.am
Makefile.in Makefile.in
PyUnitTests
RegressionTests
TAGS TAGS
acconf.h.in acconf.h.in
aclocal.m4 aclocal.m4
@ -31,12 +30,16 @@ config.status
config.sub config.sub
configure configure
configure.ac configure.ac
data_tests
depcomp depcomp
doc/Doxyfile doc/Doxyfile
doc/*.aux doc/*.aux
doc/*.cp doc/*.cp
doc/*.cps
doc/*.fn doc/*.fn
doc/*.fns
doc/*.html
doc/*.info
doc/*.info-*
doc/*.ky doc/*.ky
doc/*.log doc/*.log
doc/*.pdf doc/*.pdf
@ -47,12 +50,9 @@ doc/*.vr
doc/.dirstamp doc/.dirstamp
doc/html/ doc/html/
doc/latex/ doc/latex/
doc/ledger.info
doc/ledger3.info
doc/refman.pdf doc/refman.pdf
doc/report/ doc/report/
elisp-comp elisp-comp
expr_tests
install-sh install-sh
intl/ intl/
ledger ledger
@ -60,20 +60,16 @@ libtool
ltmain.sh ltmain.sh
m4/ m4/
make.sh make.sh
math_tests
missing missing
mkinstalldirs mkinstalldirs
po/ po/
py-compile py-compile
report_tests
shave shave
shave-libtool shave-libtool
src/system.hh.gch
stamp-h1 stamp-h1
texinfo.tex texinfo.tex
tmpcvs*/ tmpcvs*/
tmpwrk*/ tmpwrk*/
util_tests
dist/win/vc9/Debug/ dist/win/vc9/Debug/
dist/win/vc9/gen-mpir.exe dist/win/vc9/gen-mpir.exe
dist/win/vc9/gen-mpir.ilk dist/win/vc9/gen-mpir.ilk
@ -82,10 +78,6 @@ dist/win/vc9/ledger.ncb
dist/win/vc9/ledger.vcproj.*.user dist/win/vc9/ledger.vcproj.*.user
dist/win/vc9/ledger.suo dist/win/vc9/ledger.suo
dist/win/vc9/lib/Win32/Debug/ dist/win/vc9/lib/Win32/Debug/
dist/win/vc9/system.hh
doc/ledger.1.html
doc/ledger.html
doc/ledger3.html
src/TAGS src/TAGS
CMakeCache.txt CMakeCache.txt
CPackConfig.cmake CPackConfig.cmake
@ -107,14 +99,10 @@ contrib/non-profit-audit-reports/tests/general-ledger.txt
contrib/non-profit-audit-reports/tests/MANIFEST contrib/non-profit-audit-reports/tests/MANIFEST
contrib/non-profit-audit-reports/general-ledger.zip contrib/non-profit-audit-reports/general-ledger.zip
/wiki/ /wiki/
doc/ledger-mode.info
doc/ledger3.info-1
doc/ledger3.info-2
CTestTestfile.cmake
.ninja_deps .ninja_deps
.ninja_log .ninja_log
build.ninja build.ninja
rules.ninja rules.ninja
Testing/Temporary test/Testing
/MathTests /MathTests
/UtilTests /UtilTests

View file

@ -101,11 +101,11 @@ And for building the current `maint` branch:
If you build stuff using MacPorts on OS X, as I do, here is what you would If you build stuff using MacPorts on OS X, as I do, here is what you would
run: run:
sudo port install -f cmake python26 sudo port install -f cmake python26 \
libiconv +universal zlib +universal gmp +universal libiconv +universal zlib +universal gmp +universal \
mpfr +universal ncurses +universal ncursesw +universal mpfr +universal ncurses +universal ncursesw +universal \
gettext +universal libedit +universal boost-jam gettext +universal libedit +universal boost-jam \
boost +st+python26+icu texlive doxygen graphviz boost +st+python26+icu texlive doxygen graphviz \
texinfo lcov sloccount texinfo lcov sloccount
### Ubuntu ### Ubuntu
@ -113,18 +113,18 @@ run:
If you're going to build on Ubuntu, `sudo apt-get install ...` the If you're going to build on Ubuntu, `sudo apt-get install ...` the
following packages (current as of Ubuntu 14.04): following packages (current as of Ubuntu 14.04):
sudo apt-get install build-essential cmake doxygen sudo apt-get install build-essential cmake doxygen \
libboost-system-dev libboost-dev python-dev gettext git libboost-system-dev libboost-dev python-dev gettext git \
libboost-date-time-dev libboost-filesystem-dev libboost-date-time-dev libboost-filesystem-dev \
libboost-iostreams-dev libboost-python-dev libboost-regex-dev libboost-iostreams-dev libboost-python-dev libboost-regex-dev \
libboost-test-dev libedit-dev libgmp3-dev libmpfr-dev texinfo libboost-test-dev libedit-dev libgmp3-dev libmpfr-dev texinfo
Or, for Ubuntu 12.04: Or, for Ubuntu 12.04:
sudo apt-get install build-essential cmake zlib1g-dev libbz2-dev sudo apt-get install build-essential cmake zlib1g-dev libbz2-dev \
python-dev gettext libgmp3-dev libmpfr-dev libboost-dev python-dev gettext libgmp3-dev libmpfr-dev libboost-dev \
libboost-regex-dev libboost-date-time-dev libboost-regex-dev libboost-date-time-dev \
libboost-filesystem-dev libboost-python-dev texinfo lcov libboost-filesystem-dev libboost-python-dev texinfo lcov \
sloccount libboost-iostreams-dev libboost-test-dev sloccount libboost-iostreams-dev libboost-test-dev
### Debian ### Debian

View file

@ -75,8 +75,8 @@ reconcile-finish will mark all pending posting cleared."
:type 'string :type 'string
:group 'ledger-reconcile) :group 'ledger-reconcile)
(defcustom ledger-reconcile-sort-key "(date)" (defcustom ledger-reconcile-sort-key "(0)"
"Default key for sorting reconcile buffer. For no sorting by default, use '(0)'." "Default key for sorting reconcile buffer. Possible values are '(date)', '(amount)', '(payee)'. For no sorting, i.e. using ledger file order, use '(0)'."
:type 'string :type 'string
:group 'ledger-reconcile) :group 'ledger-reconcile)

View file

@ -1638,24 +1638,23 @@ post_t * instance_t::parse_post(char * line,
"line " << context.linenum << ": " << "post amount = " << amt); "line " << context.linenum << ": " << "post amount = " << amt);
amount_t diff = amt; amount_t diff = amt;
amount_t tot;
switch (account_total.type()) { switch (account_total.type()) {
case value_t::AMOUNT: case value_t::AMOUNT:
tot = account_total.as_amount(); diff -= account_total.as_amount();
break; break;
case value_t::BALANCE: case value_t::BALANCE:
if (optional<amount_t> comm_bal = if (optional<amount_t> comm_bal =
account_total.as_balance().commodity_amount(amt.commodity())) account_total.as_balance().commodity_amount(amt.commodity()))
tot = *comm_bal; diff -= *comm_bal;
break; break;
default: default:
break; break;
} }
diff -= tot; amount_t tot = amt - diff;
DEBUG("post.assign", DEBUG("post.assign",
"line " << context.linenum << ": " << "diff = " << diff); "line " << context.linenum << ": " << "diff = " << diff);

View file

@ -2,12 +2,21 @@ alias A=B:A
alias B=C:B alias B=C:B
alias C=D:C alias C=D:C
account Delta
alias D
2001-01-01 Test 2001-01-01 Test
A 10 EUR A 10 EUR
Foo Foo
2001-01-01 Test
D 20 EUR
Foo
test reg test reg
01-Jan-01 Test B:A 10 EUR 10 EUR 01-Jan-01 Test B:A 10 EUR 10 EUR
Foo -10 EUR 0 Foo -10 EUR 0
01-Jan-01 Test Delta 20 EUR 20 EUR
Foo -20 EUR 0
end test end test

View file

@ -0,0 +1,18 @@
2014-05-01 * Opening balance
Assets:Cash $100
Equity:Opening balance
2014-05-10 * Spend money
Expenses:Foo $10
Assets:Cash -$10 = $80
test bal -> 1
__ERROR__
While parsing file "$FILE", line 8:
While parsing posting:
Assets:Cash -$10 = $80
^^^
Error: Balance assertion off by $-10 (expected to see $100)
end test

View file

@ -0,0 +1,20 @@
alias A=Foo
account Bar
alias B
2001-01-01 * Test
A 10 EUR
B
test reg
01-Jan-01 Test Foo 10 EUR 10 EUR
Bar -10 EUR 0
end test
test reg --no-aliases
01-Jan-01 Test A 10 EUR 10 EUR
B -10 EUR 0
end test

View file

@ -0,0 +1,19 @@
; The option --permissive quiets balance assertions
2014-05-01 * Opening balance
Assets:Cash $100
Equity:Opening balance
2014-05-10 * Spend money
Expenses:Foo $10
Assets:Cash -$10 = $80
test bal --permissive
$90 Assets:Cash
$-100 Equity:Opening balance
$10 Expenses:Foo
--------------------
0
end test

10
test/regress/AA2FF2B.test Normal file
View file

@ -0,0 +1,10 @@
2008/01/20 * La Poste
Revenu:Invest:Exonéré
Actif:Courant:LaPosteLivretA 25,24 € = 25,24 €
test --args-only --decimal-comma bal
25,24 € Actif:Courant:LaPosteLivretA
-25,24 € Revenu:Invest:Exonéré
--------------------
0
end test

View file

@ -1,3 +1,3 @@
#!/bin/sh #!/bin/sh
aspell check --mode=texinfo $(dirname $0)/../doc/ledger3.texi aspell --lang=en_US.UTF-8 check --mode=texinfo $(dirname $0)/../doc/ledger3.texi