summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2014-05-18 08:25:30 -0700
committerCraig Earls <enderw88@gmail.com>2014-05-18 08:25:30 -0700
commit8e6cdcc1d13533252b1f6e6088dca966b64e4c88 (patch)
tree8f8fd4f644f292a25fb79d59961e135cc4b11c3a /test
parentd82c1b4b5531c7be1c1870a07f1836b230a4da27 (diff)
parent4af2b97921a68a522135f958f1999ec4b63435bb (diff)
downloadfork-ledger-8e6cdcc1d13533252b1f6e6088dca966b64e4c88.tar.gz
fork-ledger-8e6cdcc1d13533252b1f6e6088dca966b64e4c88.tar.bz2
fork-ledger-8e6cdcc1d13533252b1f6e6088dca966b64e4c88.zip
Merge branch 'master' of https://github.com/ledger/ledger
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt10
-rw-r--r--test/baseline/dir-alias.test9
-rw-r--r--test/baseline/feat-balance_assert-off.test18
-rw-r--r--test/baseline/opt-no-aliases.test20
-rw-r--r--test/baseline/opt-recursive-aliases.test (renamed from test/baseline/dir-alias-recursive.test)0
-rw-r--r--test/regress/634AA589.test19
-rw-r--r--test/regress/AA2FF2B.test10
-rw-r--r--test/unit/CMakeLists.txt2
8 files changed, 82 insertions, 6 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 97da8b24..0f19ae6f 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,7 +1,7 @@
include(ProcessorCount)
ProcessorCount(PROCESSORS)
-if(NOT PROCESSORS EQUAL 0)
+if (NOT PROCESSORS EQUAL 0)
math(EXPR JOBS "${PROCESSORS} * 2")
set(CTEST_BUILD_FLAGS -j${JOBS})
endif()
@@ -12,17 +12,17 @@ add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} ${CTEST_BUILD_FLAGS})
add_subdirectory(unit)
-if(HAVE_BOOST_PYTHON)
+if (HAVE_BOOST_PYTHON)
set(TEST_PYTHON_FLAGS "--python")
endif()
macro(add_ledger_harness_tests _class)
- if(PYTHONINTERP_FOUND)
+ if (PYTHONINTERP_FOUND)
file(GLOB ${_class}_TESTS *.test)
foreach(TestFile ${${_class}_TESTS})
get_filename_component(TestFile_Name ${TestFile} NAME_WE)
string(FIND ${TestFile_Name} "_py" TestFile_IsPythonTest)
- if((TestFile_IsPythonTest EQUAL -1) OR HAVE_BOOST_PYTHON)
+ if ((TestFile_IsPythonTest EQUAL -1) OR HAVE_BOOST_PYTHON)
add_test(${_class}Test_${TestFile_Name}
${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/RegressTests.py
${LEDGER_LOCATION} ${PROJECT_SOURCE_DIR}
@@ -39,7 +39,7 @@ add_subdirectory(baseline)
add_subdirectory(regress)
# jww (2014-04-17): This is temporary until we find a fix.
-#if(PYTHONINTERP_FOUND)
+#if (PYTHONINTERP_FOUND)
# set(_class DocTests)
# file(GLOB ${_class}_TESTS ${PROJECT_SOURCE_DIR}/doc/*.texi)
# foreach(TestFile ${${_class}_TESTS})
diff --git a/test/baseline/dir-alias.test b/test/baseline/dir-alias.test
index 6245d944..103868d8 100644
--- a/test/baseline/dir-alias.test
+++ b/test/baseline/dir-alias.test
@@ -2,12 +2,21 @@ alias A=B:A
alias B=C:B
alias C=D:C
+account Delta
+ alias D
+
2001-01-01 Test
A 10 EUR
Foo
+2001-01-01 Test
+ D 20 EUR
+ Foo
+
test reg
01-Jan-01 Test B:A 10 EUR 10 EUR
Foo -10 EUR 0
+01-Jan-01 Test Delta 20 EUR 20 EUR
+ Foo -20 EUR 0
end test
diff --git a/test/baseline/feat-balance_assert-off.test b/test/baseline/feat-balance_assert-off.test
new file mode 100644
index 00000000..fed24d4a
--- /dev/null
+++ b/test/baseline/feat-balance_assert-off.test
@@ -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
+
diff --git a/test/baseline/opt-no-aliases.test b/test/baseline/opt-no-aliases.test
new file mode 100644
index 00000000..9deeca5d
--- /dev/null
+++ b/test/baseline/opt-no-aliases.test
@@ -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
+
diff --git a/test/baseline/dir-alias-recursive.test b/test/baseline/opt-recursive-aliases.test
index d9addcd1..d9addcd1 100644
--- a/test/baseline/dir-alias-recursive.test
+++ b/test/baseline/opt-recursive-aliases.test
diff --git a/test/regress/634AA589.test b/test/regress/634AA589.test
new file mode 100644
index 00000000..8f8ff031
--- /dev/null
+++ b/test/regress/634AA589.test
@@ -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
+
diff --git a/test/regress/AA2FF2B.test b/test/regress/AA2FF2B.test
new file mode 100644
index 00000000..944cdfea
--- /dev/null
+++ b/test/regress/AA2FF2B.test
@@ -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
diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt
index b3639c06..23bb0ea4 100644
--- a/test/unit/CMakeLists.txt
+++ b/test/unit/CMakeLists.txt
@@ -5,7 +5,7 @@ endmacro(add_ledger_test _name)
include_directories(${PROJECT_SOURCE_DIR}/src)
-if(BUILD_LIBRARY)
+if (BUILD_LIBRARY)
add_executable(UtilTests t_times.cc)
add_ledger_test(UtilTests)