summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt11
-rwxr-xr-xtest/CheckBaselineTests.py77
-rwxr-xr-xtest/CheckManpage.py45
-rwxr-xr-xtest/CheckOptions.py98
-rwxr-xr-xtest/CheckTests.py87
-rwxr-xr-xtest/CheckTexinfo.py116
-rwxr-xr-xtest/DocTests.py107
-rwxr-xr-xtest/GenerateTests.py4
-rwxr-xr-xtest/RegressTests.py3
-rw-r--r--test/baseline/cmd-cleared.test2
-rw-r--r--test/baseline/cmd-convert.test (renamed from test/baseline/cmd-convert.test.disable)4
-rw-r--r--test/baseline/opt-auto-match.test47
-rw-r--r--test/baseline/opt-cleared-format.test20
-rw-r--r--test/baseline/opt-explicit.test14
-rw-r--r--test/baseline/opt-file.test (renamed from test/baseline/opt-file.test.disable)0
-rw-r--r--test/baseline/opt-generated.test0
-rw-r--r--test/baseline/opt-init-file.dat1
-rw-r--r--test/baseline/opt-init-file.test10
-rw-r--r--test/baseline/opt-no-pager.test0
-rw-r--r--test/baseline/opt-no-revalued.test58
-rw-r--r--test/baseline/opt-no-rounding.test81
-rw-r--r--test/baseline/opt-no-titles.test10
-rw-r--r--test/baseline/opt-permissive.test19
-rw-r--r--test/baseline/opt-price-db.dat2
-rw-r--r--test/baseline/opt-price-db.test8
-rw-r--r--test/baseline/opt-rich-data.test10
-rw-r--r--test/baseline/opt-script.dat3
-rw-r--r--test/baseline/opt-script.test15
-rw-r--r--test/baseline/opt-value-expr.test48
-rw-r--r--test/baseline/opt-values.test6
-rw-r--r--test/baseline/opt-verify-memory.test0
-rw-r--r--test/regress/1102.test8
-rw-r--r--test/regress/1106.test11
-rw-r--r--test/regress/25A099C9.test61
-rw-r--r--test/regress/25A099C9.test.disable43
-rw-r--r--test/regress/634AA589.test19
-rw-r--r--test/unit/CMakeLists.txt7
-rw-r--r--test/unit/t_balance.cc3
38 files changed, 850 insertions, 208 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 44db81fb..0e7d5f2c 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -42,10 +42,19 @@ if (PYTHONINTERP_FOUND)
foreach(TestFile ${${_class}_TESTS})
get_filename_component(TestFile_Name ${TestFile} NAME_WE)
add_test(NAME ${_class}Test_${TestFile_Name}
- COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/DocTests.py
+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/${_class}.py
--ledger $<TARGET_FILE:ledger> --file ${TestFile})
set_target_properties(check PROPERTIES DEPENDS ${_class}Test_${TestFile_Name})
endforeach()
+
+ # CheckManpage and CheckTexinfo are disabled, since they do not work
+ # reliably yet, instead they are being run as a Travis CI report.
+ list(APPEND CheckOptions CheckBaselineTests) #CheckManpage CheckTexinfo
+ foreach(_class ${CheckOptions})
+ add_test(NAME ${_class}
+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/${_class}.py
+ --ledger $<TARGET_FILE:ledger> --source ${PROJECT_SOURCE_DIR})
+ endforeach()
endif()
### CMakeLists.txt ends here
diff --git a/test/CheckBaselineTests.py b/test/CheckBaselineTests.py
new file mode 100755
index 00000000..570b93be
--- /dev/null
+++ b/test/CheckBaselineTests.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from __future__ import print_function
+
+import sys
+import re
+import os
+import argparse
+
+from os.path import *
+from subprocess import Popen, PIPE
+
+from CheckOptions import CheckOptions
+
+class CheckBaselineTests (CheckOptions):
+ def __init__(self, args):
+ CheckOptions.__init__(self, args)
+ self.missing_baseline_tests = set()
+
+ self.untested_options = [
+ 'anon',
+ 'args-only',
+ 'debug',
+ 'download',
+ 'force-color',
+ 'force-pager',
+ 'generated',
+ 'help',
+ 'import',
+ 'no-color',
+ 'no-pager',
+ 'options',
+ 'price-exp',
+ 'seed',
+ 'trace',
+ 'verbose',
+ 'verify',
+ 'verify-memory',
+ 'version'
+ ]
+
+ def main(self):
+ for option in self.ledger_options():
+ if option in self.untested_options: continue
+ baseline_testpath = join(self.source, 'test', 'baseline', 'opt-%s.test' % option)
+ if exists(baseline_testpath) and getsize(baseline_testpath) > 0: continue
+ self.missing_baseline_tests.add(option)
+
+ if len(self.missing_baseline_tests):
+ print("Missing Baseline test for:%s%s\n" % (self.sep, self.sep.join(sorted(list(self.missing_baseline_tests)))))
+
+ errors = len(self.missing_baseline_tests)
+ return errors
+
+if __name__ == "__main__":
+ def getargs():
+ parser = argparse.ArgumentParser(prog='CheckBaselineTests',
+ description='Check that ledger options are tested')
+ parser.add_argument('-l', '--ledger',
+ dest='ledger',
+ type=str,
+ action='store',
+ required=True,
+ help='the path to the ledger executable to test with')
+ parser.add_argument('-s', '--source',
+ dest='source',
+ type=str,
+ action='store',
+ required=True,
+ help='the path to the top level ledger source directory')
+ return parser.parse_args()
+
+ args = getargs()
+ script = CheckBaselineTests(args)
+ status = script.main()
+ sys.exit(status)
diff --git a/test/CheckManpage.py b/test/CheckManpage.py
new file mode 100755
index 00000000..944f4e07
--- /dev/null
+++ b/test/CheckManpage.py
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from __future__ import print_function
+
+import sys
+import re
+import os
+import argparse
+
+from os.path import *
+from subprocess import Popen, PIPE
+
+from CheckOptions import CheckOptions
+
+class CheckManpage (CheckOptions):
+ def __init__(self, args):
+ CheckOptions.__init__(self, args)
+ self.option_pattern = '\.It Fl \\\\-([-A-Za-z]+)'
+ self.function_pattern = '\.It Fn ([-A-Za-z_]+)'
+ self.source_file = join(self.source, 'doc', 'ledger.1')
+ self.source_type = 'manpage'
+
+if __name__ == "__main__":
+ def getargs():
+ parser = argparse.ArgumentParser(prog='CheckManpage',
+ description='Check that ledger options are documented in the manpage')
+ parser.add_argument('-l', '--ledger',
+ dest='ledger',
+ type=str,
+ action='store',
+ required=True,
+ help='the path to the ledger executable to test with')
+ parser.add_argument('-s', '--source',
+ dest='source',
+ type=str,
+ action='store',
+ required=True,
+ help='the path to the top level ledger source directory')
+ return parser.parse_args()
+
+ args = getargs()
+ script = CheckManpage(args)
+ status = script.main()
+ sys.exit(status)
diff --git a/test/CheckOptions.py b/test/CheckOptions.py
new file mode 100755
index 00000000..e4a1fdc3
--- /dev/null
+++ b/test/CheckOptions.py
@@ -0,0 +1,98 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from __future__ import print_function
+
+import re
+import os
+import sys
+import shlex
+import argparse
+import subprocess
+
+from os.path import *
+from subprocess import Popen, PIPE
+
+class CheckOptions (object):
+ def __init__(self, args):
+ self.option_pattern = None
+ self.source_file = None
+ self.sep = "\n --"
+
+ self.ledger = os.path.abspath(args.ledger)
+ self.source = os.path.abspath(args.source)
+
+ self.missing_options = set()
+ self.unknown_options = set()
+ self.missing_functions = set()
+ self.unknown_functions = set()
+
+ def find_pattern(self, filename, pattern):
+ regex = re.compile(pattern)
+ return {match.group(1) for match in {regex.match(line) for line in open(filename)} if match}
+
+ def find_options(self, filename):
+ return self.find_pattern(filename, self.option_pattern)
+
+ def find_functions(self, filename):
+ return self.find_pattern(filename, self.function_pattern)
+ def find_alternates(self):
+ command = shlex.split('grep --no-filename OPT_ALT')
+ for source_file in ['session', 'report']:
+ command.append(os.path.join(self.source, 'src', '%s.cc' % source_file))
+ try:
+ output = subprocess.check_output(command).split('\n');
+ except subprocess.CalledProcessError:
+ output = ''
+
+ regex = re.compile(r'OPT_ALT\([^,]*,\s*([^)]+?)_?\)');
+ alternates = {match.group(1).replace('_', '-') for match in {regex.search(line) for line in output} if match}
+ return alternates
+
+ def ledger_options(self):
+ pipe = Popen('%s --debug option.names parse true' %
+ self.ledger, shell=True, stdout=PIPE, stderr=PIPE)
+ regex = re.compile('\[DEBUG\]\s+Option:\s+(.*?)_?$')
+ ledger_options = {match.group(1).replace('_', '-') for match in {regex.search(line.decode()) for line in pipe.stderr} if match}
+ return ledger_options
+
+ def ledger_functions(self):
+ command = shlex.split('grep --no-filename fn_ %s' % (os.path.join(self.source, 'src', 'report.h')))
+ try:
+ output = subprocess.check_output(command).split('\n');
+ except subprocess.CalledProcessError:
+ output = ''
+
+ regex = re.compile(r'fn_([^(]+)\(');
+ functions = {match.group(1) for match in {regex.search(line) for line in output} if match}
+ return functions
+
+ def main(self):
+ options = self.find_options(self.source_file)
+ for option in self.ledger_options():
+ if option not in options:
+ self.missing_options.add(option)
+ else:
+ options.remove(option)
+ known_alternates = self.find_alternates()
+ self.unknown_options = {option for option in options if option not in known_alternates}
+
+ functions = self.find_functions(self.source_file)
+ for function in self.ledger_functions():
+ if function not in functions:
+ self.missing_functions.add(function)
+ else:
+ functions.remove(function)
+ known_functions = ['tag', 'has_tag', 'meta', 'has_meta']
+ self.unknown_functions = {function for function in functions if function not in known_functions}
+
+ if len(self.missing_options):
+ print("Missing %s option entries for:%s%s\n" % (self.source_type, self.sep, self.sep.join(sorted(list(self.missing_options)))))
+ if len(self.unknown_options):
+ print("%s entry for unknown options:%s%s\n" % (self.source_type, self.sep, self.sep.join(sorted(list(self.unknown_options)))))
+ if len(self.missing_functions):
+ print("Missing %s function entries for:%s%s\n" % (self.source_type, '\n ', '\n '.join(sorted(list(self.missing_functions)))))
+ if len(self.unknown_functions):
+ print("%s entry for unknown functions:%s%s\n" % (self.source_type, '\n ', '\n '.join(sorted(list(self.unknown_functions)))))
+ errors = len(self.missing_options) + len(self.unknown_options) + len(self.missing_functions) + len(self.unknown_functions)
+ return errors
diff --git a/test/CheckTests.py b/test/CheckTests.py
deleted file mode 100755
index 1a364ff4..00000000
--- a/test/CheckTests.py
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/env python
-
-import sys
-import re
-import os
-
-from os.path import *
-from subprocess import Popen, PIPE
-
-ledger_binary = sys.argv[1]
-source_topdir = sys.argv[2]
-
-documented_options = []
-for line in open(join(source_topdir, 'doc', 'ledger.1')):
- match = re.match('\.It Fl \\\\-([-A-Za-z]+)', line)
- if match:
- option = match.group(1)
- if option not in documented_options:
- documented_options.append(option)
-
-pipe = Popen('%s --debug option.names parse true' % ledger_binary,
- shell=True, stdout=PIPE, stderr=PIPE)
-errors = 0
-
-untested_options = [
- 'anon',
- 'args-only',
- 'cache',
- 'debug',
- 'download',
- 'file',
- 'force-color',
- 'force-pager',
- 'full-help',
- 'help',
- 'help-calc',
- 'help-comm',
- 'help-disp',
- 'import',
- 'init-file',
- 'no-color',
- 'options',
- 'price-db',
- 'price-exp',
- 'revalued-total',
- 'script',
- 'seed',
- 'trace',
- 'verbose',
- 'verify',
- 'version'
-]
-
-for line in pipe.stderr:
- match = re.search('\[DEBUG\] Option: (.*)', line)
- if match:
- option = match.group(1)
-
- option = re.sub('_', '-', option)
- option = re.sub('-$', '', option)
-
- if option not in untested_options and \
- not exists(join(source_topdir, 'test', 'baseline',
- 'opt-%s.test' % option)):
- print "Baseline test missing for --%s" % option
- errors += 1
-
- if option not in documented_options:
- print "Man page entry missing for --%s" % option
- errors += 1
- else:
- documented_options.remove(option)
-
-known_alternates = [
- 'cost',
- 'first',
- 'import',
- 'last',
- 'leeway',
- 'period-sort'
-]
-
-for option in documented_options:
- if option not in known_alternates:
- print "Man page entry for unknown option --%s" % option
-
-sys.exit(errors)
diff --git a/test/CheckTexinfo.py b/test/CheckTexinfo.py
new file mode 100755
index 00000000..cd167eba
--- /dev/null
+++ b/test/CheckTexinfo.py
@@ -0,0 +1,116 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from __future__ import print_function
+
+import sys
+import re
+import os
+import argparse
+
+from os.path import *
+from subprocess import Popen, PIPE
+
+from CheckOptions import CheckOptions
+
+class CheckTexinfo (CheckOptions):
+ def __init__(self, args):
+ CheckOptions.__init__(self, args)
+ self.option_pattern = '^@item\s+--([-A-Za-z]+)'
+ self.function_pattern = '^@defun\s+([-A-Za-z_]+)'
+ self.source_file = join(self.source, 'doc', 'ledger3.texi')
+ self.source_type = 'texinfo'
+
+
+ def find_functions(self, filename):
+ functions = set()
+ state_normal = 0
+ state_function = 1
+ state = state_normal
+ function = None
+ fun_doc = str()
+ fun_example = False
+ item_regex = re.compile(self.function_pattern)
+ itemx_regex = re.compile('^@defunx')
+ example_regex = re.compile('^@smallexample\s+@c\s+command:')
+ fix_regex = re.compile('FIX')
+ comment_regex = re.compile('^\s*@c')
+ for line in open(filename):
+ line = line.strip()
+ if state == state_normal:
+ match = item_regex.match(line)
+ if match:
+ state = state_function
+ function = match.group(1)
+ elif state == state_function:
+ if line == '@end defun':
+ if function and fun_example and len(fun_doc) and not fix_regex.search(fun_doc):
+ functions.add(function)
+ state = state_normal
+ fun_example = None
+ fun_doc = str()
+ elif itemx_regex.match(line):
+ continue
+ elif example_regex.match(line):
+ fun_example = True
+ elif not comment_regex.match(line):
+ fun_doc += line
+ return functions
+
+ def find_options(self, filename):
+ options = set()
+ state_normal = 0
+ state_option_table = 1
+ state = state_normal
+ option = None
+ opt_doc = str()
+ item_regex = re.compile(self.option_pattern)
+ itemx_regex = re.compile('^@itemx')
+ fix_regex = re.compile('FIX')
+ comment_regex = re.compile('^\s*@c')
+ for line in open(filename):
+ line = line.strip()
+ if state == state_normal:
+ if line == '@ftable @option':
+ state = state_option_table
+ elif state == state_option_table:
+ if line == '@end ftable':
+ if option and len(opt_doc) and not fix_regex.search(opt_doc):
+ options.add(option)
+ state = state_normal
+ option = None
+ continue
+ match = item_regex.match(line)
+ if match:
+ if option and len(opt_doc) and not fix_regex.search(opt_doc):
+ options.add(option)
+ option = match.group(1)
+ opt_doc = str()
+ elif itemx_regex.match(line):
+ continue
+ elif not comment_regex.match(line):
+ opt_doc += line
+ return options
+
+if __name__ == "__main__":
+ def getargs():
+ parser = argparse.ArgumentParser(prog='CheckTexinfo',
+ description='Check that ledger options are documented in the texinfo manual')
+ parser.add_argument('-l', '--ledger',
+ dest='ledger',
+ type=str,
+ action='store',
+ required=True,
+ help='the path to the ledger executable to test with')
+ parser.add_argument('-s', '--source',
+ dest='source',
+ type=str,
+ action='store',
+ required=True,
+ help='the path to the top level ledger source directory')
+ return parser.parse_args()
+
+ args = getargs()
+ script = CheckTexinfo(args)
+ status = script.main()
+ sys.exit(status)
diff --git a/test/DocTests.py b/test/DocTests.py
index ea32608e..7af7abc3 100755
--- a/test/DocTests.py
+++ b/test/DocTests.py
@@ -4,6 +4,7 @@
import os
import re
import sys
+import shlex
import hashlib
import argparse
import subprocess
@@ -18,13 +19,17 @@ class DocTests:
self.verbose = args.verbose
self.tests = args.examples
- self.examples = dict()
- self.test_files = list()
- self.testin_token = 'command'
- self.testout_token = 'output'
- self.testdat_token = 'input'
+ self.examples = dict()
+ self.test_files = list()
+ self.testin_token = 'command'
+ self.testout_token = 'output'
+ self.testdat_token = 'input'
+ self.testfile_token = 'file'
self.validate_token = 'validate'
- self.testwithdat_token = 'with_input'
+ self.validate_cmd_token = 'validate-command'
+ self.validate_dat_token = 'validate-data'
+ self.testwithdat_token = 'with_input'
+ self.testwithfile_token = 'with_file'
def read_example(self):
endexample = re.compile(r'^@end\s+smallexample\s*$')
@@ -33,15 +38,16 @@ class DocTests:
line = self.file.readline()
self.current_line += 1
if len(line) <= 0 or endexample.match(line): break
- example += line.replace("@@","@").replace("@{","{").replace("@}","}")
+ # Replace special texinfo character sequences with their ASCII counterpart
+ example += re.sub(r'@([@{}])', r'\1', line)
return example
def test_id(self, example):
return hashlib.sha1(example.rstrip()).hexdigest()[0:7].upper()
def find_examples(self):
- startexample = re.compile(r'^@smallexample\s+@c\s+(%s|%s|%s)(?::([\dA-Fa-f]+|validate))?(?:,(.*))?'
- % (self.testin_token, self.testout_token, self.testdat_token))
+ startexample = re.compile(r'^@smallexample\s+@c\s+(%s|%s|%s|%s)(?::([\dA-Fa-f]+|validate))?(?:,(.*))?'
+ % (self.testin_token, self.testout_token, self.testdat_token, self.testfile_token))
while True:
line = self.file.readline()
self.current_line += 1
@@ -76,9 +82,9 @@ class DocTests:
if test_id == self.validate_token:
test_id = "Val-" + str(test_begin_line)
if test_kind == self.testin_token:
- test_kind = "validate-command"
+ test_kind = self.validate_cmd_token
elif test_kind == self.testdat_token:
- test_kind = "validate-data"
+ test_kind = self.validate_dat_token
try:
self.examples[test_id]
except KeyError:
@@ -102,20 +108,21 @@ class DocTests:
validate_command = False
try:
command = example[self.testin_token][self.testin_token]
+ command = re.sub(r'\\\n', '', command)
except KeyError:
- if 'validate-data' in example:
+ if self.validate_dat_token in example:
command = '$ ledger bal'
- elif 'validate-command' in example:
+ elif self.validate_cmd_token in example:
validate_command = True
- command = example['validate-command']['validate-command']
+ command = example[self.validate_cmd_token][self.validate_cmd_token]
else:
return None
- command = command.rstrip().split()
+ command = filter(lambda x: x != '\n', shlex.split(command))
if command[0] == '$': command.remove('$')
index = command.index('ledger')
command[index] = self.ledger
- for i,argument in enumerate('--args-only --columns 80'.split()):
+ for i,argument in enumerate(shlex.split('--args-only --columns 80')):
command.insert(index+i+1, argument)
try:
@@ -143,7 +150,7 @@ class DocTests:
for test_id in tests:
validation = False
- if "validate-data" in self.examples[test_id] or "validate-command" in self.examples[test_id]:
+ if self.validate_dat_token in self.examples[test_id] or self.validate_cmd_token in self.examples[test_id]:
validation = True
example = self.examples[test_id]
try:
@@ -152,51 +159,52 @@ class DocTests:
failed.add(test_id)
continue
- try:
- output = example[self.testout_token][self.testout_token]
- except KeyError:
- output = None
-
- try:
- input = example[self.testdat_token][self.testdat_token]
- except KeyError:
- try:
- with_input = example[self.testin_token]['opts'][self.testwithdat_token]
- input = self.examples[with_input][self.testdat_token][self.testdat_token]
- except KeyError:
- try:
- input = example['validate-data']['validate-data']
- except KeyError:
- input = None
+ output = example.get(self.testout_token, {}).get(self.testout_token)
+ input = example.get(self.testdat_token, {}).get(self.testdat_token)
+ if not input:
+ with_input = example.get(self.testin_token, {}).get('opts', {}).get(self.testwithdat_token)
+ input = self.examples.get(with_input, {}).get(self.testdat_token, {}).get(self.testdat_token)
+ if not input:
+ input = example.get(self.validate_dat_token, {}).get(self.validate_dat_token)
- if command and (output or validation):
+ if command and (output != None or validation):
test_file_created = False
if findex:
scriptpath = os.path.dirname(os.path.realpath(__file__))
- test_input_dir = scriptpath + '/../test/input/'
+ test_input_dir = os.path.join(scriptpath, '..', 'test', 'input')
test_file = command[findex]
if not os.path.exists(test_file):
if input:
test_file_created = True
with open(test_file, 'w') as f:
f.write(input)
- elif os.path.exists(test_input_dir + test_file):
- command[findex] = test_input_dir + test_file
- error = False
+ elif os.path.exists(os.path.join(test_input_dir, test_file)):
+ command[findex] = os.path.join(test_input_dir, test_file)
try:
- verify = subprocess.check_output(command)
- except:
- verify = str()
- error = True
- valid = (output == verify) or (not error and validation)
+ convert_idx = command.index('convert')
+ convert_file = command[convert_idx+1]
+ convert_data = example[self.testfile_token][self.testfile_token]
+ if not os.path.exists(convert_file):
+ with open(convert_file, 'w') as f:
+ f.write(convert_data)
+ except ValueError:
+ pass
+ error = None
+ try:
+ verify = subprocess.check_output(command, stderr=subprocess.STDOUT)
+ valid = (output == verify) or (not error and validation)
+ except subprocess.CalledProcessError, e:
+ error = e.output
+ valid = False
+ failed.add(test_id)
if valid and test_file_created:
os.remove(test_file)
if self.verbose > 0:
- print test_id, ':', 'Passed' if valid else 'FAILED'
+ print test_id, ':', 'Passed' if valid else 'FAILED: {}'.format(error) if error else 'FAILED'
else:
sys.stdout.write('.' if valid else 'E')
- if not valid:
+ if not (valid or error):
failed.add(test_id)
if self.verbose > 1:
print ' '.join(command)
@@ -204,6 +212,12 @@ class DocTests:
for line in unified_diff(output.split('\n'), verify.split('\n'), fromfile='generated', tofile='expected'):
print(line)
print
+ else:
+ if self.verbose > 0:
+ print test_id, ':', 'Skipped'
+ else:
+ sys.stdout.write('X')
+
if not self.verbose:
print
if len(failed) > 0:
@@ -221,7 +235,8 @@ class DocTests:
if __name__ == "__main__":
def getargs():
- parser = argparse.ArgumentParser(prog='DocTests', description='Test ledger examples from the documentation', prefix_chars='-')
+ parser = argparse.ArgumentParser(prog='DocTests',
+ description='Test and validate ledger examples from the texinfo manual')
parser.add_argument('-v', '--verbose',
dest='verbose',
action='count',
diff --git a/test/GenerateTests.py b/test/GenerateTests.py
index 2e956db0..1a9045a2 100755
--- a/test/GenerateTests.py
+++ b/test/GenerateTests.py
@@ -79,6 +79,8 @@ def generation_test(seed):
p_cout_bal.stdin.close()
cout_lines = harness.readlines(p_cout_bal.stdout)
+ if len(cout_lines) == 0:
+ return False
#norm_cout_lines = [normalize(line) for line in cout_lines]
if not harness.wait(p_cout_bal, msg=("Stdout balance for seed %d failed:" % seed)):
@@ -89,6 +91,8 @@ def generation_test(seed):
p_print_bal.stdin.close()
print_lines = harness.readlines(p_print_bal.stdout)
+ if len(print_lines) == 0:
+ return False
if not harness.wait(p_print_bal, msg=("Print balance for seed %d failed:" % seed)):
return False
diff --git a/test/RegressTests.py b/test/RegressTests.py
index 01e14191..0fef2127 100755
--- a/test/RegressTests.py
+++ b/test/RegressTests.py
@@ -57,6 +57,9 @@ class RegressFile(object):
in_error = False
line = self.fd.readline()
+ if not line:
+ print >>sys.stderr, "WARNING: Empty testfile detected: %s" % (self.filename)
+ return False
#print "line =", line
while line:
if line.startswith("test "):
diff --git a/test/baseline/cmd-cleared.test b/test/baseline/cmd-cleared.test
index 501d207f..91219a40 100644
--- a/test/baseline/cmd-cleared.test
+++ b/test/baseline/cmd-cleared.test
@@ -30,7 +30,7 @@ test cleared
-20 0 F
-30 -30 12-Feb-26 G
-40 0 H
----------------- ---------------- ---------
+---------------- ---------------- ---------
0 0
end test
diff --git a/test/baseline/cmd-convert.test.disable b/test/baseline/cmd-convert.test
index d444da52..8ee5bb2e 100644
--- a/test/baseline/cmd-convert.test.disable
+++ b/test/baseline/cmd-convert.test
@@ -17,7 +17,7 @@ end test
test -f /dev/null --input-date-format "%m/%d/%Y" convert test/baseline/cmd-convert3.dat -> 1
__ERROR__
-While parsing file "$sourcepath/test/baseline/cmd-convert3.dat", line 1:
+While parsing file "$sourcepath/test/baseline/cmd-convert3.dat", line 1:
While parsing CSV line:
01/01/2011,,
@@ -26,7 +26,7 @@ end test
test -f /dev/null convert test/baseline/cmd-convert4.dat -> 1
__ERROR__
-While parsing file "$sourcepath/test/baseline/cmd-convert4.dat", line 1:
+While parsing file "$sourcepath/test/baseline/cmd-convert4.dat", line 1:
While parsing CSV line:
bogus,$10,
diff --git a/test/baseline/opt-auto-match.test b/test/baseline/opt-auto-match.test
index 7c3fb40a..54a1053b 100644
--- a/test/baseline/opt-auto-match.test
+++ b/test/baseline/opt-auto-match.test
@@ -14,17 +14,58 @@
Expenses:Food 20.00 EUR
Liabilities:CC -20.00 EUR
+test --input-date-format "%Y-%m-%d" convert test/baseline/opt-auto-match.dat
+2012/03/01 * Food
+ Expenses:Unknown 10
+ Equity:Unknown
+
+2012/03/02 * Phone
+ Expenses:Unknown 10
+ Equity:Unknown
+
+2012/03/02 * Dining
+ Expenses:Unknown 10
+ Equity:Unknown
+end test
+
test --input-date-format "%Y-%m-%d" --auto-match convert test/baseline/opt-auto-match.dat
2012/03/01 * Food
- Assets:Cash 10
+ Expenses:Food 10
Equity:Unknown
2012/03/02 * Phone
- Assets:Cash 10
+ Expenses:Phone 10
Equity:Unknown
2012/03/02 * Dining
- Liabilities:CC 10
+ Expenses:Food 10
Equity:Unknown
end test
+test --input-date-format "%Y-%m-%d" --account Assets:Bank convert test/baseline/opt-auto-match.dat
+2012/03/01 * Food
+ Expenses:Unknown 10
+ Assets:Bank
+
+2012/03/02 * Phone
+ Expenses:Unknown 10
+ Assets:Bank
+
+2012/03/02 * Dining
+ Expenses:Unknown 10
+ Assets:Bank
+end test
+
+test --input-date-format "%Y-%m-%d" --auto-match --account Assets:Bank convert test/baseline/opt-auto-match.dat
+2012/03/01 * Food
+ Expenses:Food 10
+ Assets:Bank
+
+2012/03/02 * Phone
+ Expenses:Phone 10
+ Assets:Bank
+
+2012/03/02 * Dining
+ Expenses:Food 10
+ Assets:Bank
+end test
diff --git a/test/baseline/opt-cleared-format.test b/test/baseline/opt-cleared-format.test
index e69de29b..4d3ea267 100644
--- a/test/baseline/opt-cleared-format.test
+++ b/test/baseline/opt-cleared-format.test
@@ -0,0 +1,20 @@
+test cleared --file test/input/drewr3.dat --cleared-format "%-30(account) %15(get_at(total_expr, 0)) %15(get_at(total_expr, 1))\n%/"
+Assets $ -3,804.00 $ 775.00
+Assets:Checking $ 1,396.00 $ 775.00
+Assets:Checking:Business $ 30.00 0
+Assets:Savings $ -5,200.00 0
+Equity:Opening Balances $ -1,000.00 $ -1,000.00
+Expenses $ 6,654.00 $ 225.00
+Expenses:Auto $ 5,500.00 0
+Expenses:Books $ 20.00 0
+Expenses:Escrow $ 300.00 0
+Expenses:Food:Groceries $ 334.00 $ 225.00
+Expenses:Interest:Mortgage $ 500.00 0
+Income $ -2,030.00 0
+Income:Salary $ -2,000.00 0
+Income:Sales $ -30.00 0
+Liabilities $ -63.60 0
+Liabilities:MasterCard $ -20.00 0
+Liabilities:Mortgage:Principal $ 200.00 0
+Liabilities:Tithe $ -243.60 0
+end test
diff --git a/test/baseline/opt-explicit.test b/test/baseline/opt-explicit.test
index defae179..20b74913 100644
--- a/test/baseline/opt-explicit.test
+++ b/test/baseline/opt-explicit.test
@@ -2,16 +2,18 @@ account Assets:Cash
account Expenses:Phone
account Expenses:Rent
commodity GBP
+tag bar
-2012-03-20 Phone
+2012-03-20 * Phone
+ ; :bar:
Expenses:Phone 20.00 GBP
Assets:Cash
-2012-03-21 Rent
+2012-03-21 * Rent
Expenses:Rent 550.00 GBP
Assets:Cash
-2012-03-22 Food
+2012-03-22 * Food
; :food:
Expenses:Food 20.00 EUR
Assets:Cash
@@ -27,8 +29,8 @@ test bal --explicit --strict
--------------------
0
__ERROR__
-Warning: "$FILE", line 16: Unknown account 'Expenses:Food'
-Warning: "$FILE", line 16: Unknown commodity 'EUR'
-Warning: "$FILE", line 17: Unknown metadata tag 'food'
+Warning: "$FILE", line 18: Unknown account 'Expenses:Food'
+Warning: "$FILE", line 18: Unknown commodity 'EUR'
+Warning: "$FILE", line 19: Unknown metadata tag 'food'
end test
diff --git a/test/baseline/opt-file.test.disable b/test/baseline/opt-file.test
index 66d0ab1b..66d0ab1b 100644
--- a/test/baseline/opt-file.test.disable
+++ b/test/baseline/opt-file.test
diff --git a/test/baseline/opt-generated.test b/test/baseline/opt-generated.test
deleted file mode 100644
index e69de29b..00000000
--- a/test/baseline/opt-generated.test
+++ /dev/null
diff --git a/test/baseline/opt-init-file.dat b/test/baseline/opt-init-file.dat
new file mode 100644
index 00000000..92c5307a
--- /dev/null
+++ b/test/baseline/opt-init-file.dat
@@ -0,0 +1 @@
+--decimal-comma
diff --git a/test/baseline/opt-init-file.test b/test/baseline/opt-init-file.test
new file mode 100644
index 00000000..128814e1
--- /dev/null
+++ b/test/baseline/opt-init-file.test
@@ -0,0 +1,10 @@
+2012-03-17 Quick
+ Expenses:Food 12,50 €
+ Assets:Cash
+
+test --init-file test/baseline/opt-init-file.dat bal
+ -12,50 € Assets:Cash
+ 12,50 € Expenses:Food
+--------------------
+ 0
+end test
diff --git a/test/baseline/opt-no-pager.test b/test/baseline/opt-no-pager.test
deleted file mode 100644
index e69de29b..00000000
--- a/test/baseline/opt-no-pager.test
+++ /dev/null
diff --git a/test/baseline/opt-no-revalued.test b/test/baseline/opt-no-revalued.test
new file mode 100644
index 00000000..487ffa30
--- /dev/null
+++ b/test/baseline/opt-no-revalued.test
@@ -0,0 +1,58 @@
+2009/01/01 Sample 1a
+ Assets:Brokerage:Stocks 100 S
+ Assets:Brokerage:Cash -100 P
+
+P 2009/01/01 00:00:00 S 2 P
+
+2009/02/01 Sample 2a
+ Assets:Brokerage:Stocks 100 S @ 1 P
+ Assets:Brokerage:Cash
+
+P 2009/02/01 00:00:00 S 4 P
+
+2009/03/01 Sample 3a
+ Assets:Brokerage:Stocks 100 S @@ 100 P
+ Assets:Brokerage:Cash
+
+P 2009/03/01 00:00:00 S 8 P
+
+2009/04/01 Sample 4a
+ Assets:Brokerage:Cash 100 P
+ Assets:Brokerage:Stocks -100 S {1 P}
+
+P 2009/04/01 00:00:00 S 16 P
+
+; In this usage case, the top amount is always secondary
+; 2010/01/01 Sample 1b
+; Assets:Brokerage:Cash -100 P
+; Assets:Brokerage:Stocks 100 S
+;
+; P 2010/01/01 00:00:00 S 2 P
+
+2010/02/01 Sample 2b
+ Assets:Brokerage:Cash
+ Assets:Brokerage:Stocks 100 S @ 1 P
+
+P 2010/02/01 00:00:00 S 4 P
+
+2010/03/01 Sample 3b
+ Assets:Brokerage:Cash
+ Assets:Brokerage:Stocks 100 S @@ 100 P
+
+P 2010/03/01 00:00:00 S 8 P
+
+2010/04/01 Sample 4b
+ Assets:Brokerage:Stocks -100 S {1 P}
+ Assets:Brokerage:Cash 100 P
+
+P 2010/04/01 00:00:00 S 16 P
+
+test reg --market --no-revalued stocks
+09-Jan-01 Sample 1a Asset:Brokerage:Stocks 200 P 200 P
+09-Feb-01 Sample 2a Asset:Brokerage:Stocks 400 P 800 P
+09-Mar-01 Sample 3a Asset:Brokerage:Stocks 800 P 2400 P
+09-Apr-01 Sample 4a Asset:Brokerage:Stocks -1600 P 3200 P
+10-Feb-01 Sample 2b Asset:Brokerage:Stocks 400 P 1200 P
+10-Mar-01 Sample 3b Asset:Brokerage:Stocks 800 P 3200 P
+10-Apr-01 Sample 4b Asset:Brokerage:Stocks -1600 P 4800 P
+end test
diff --git a/test/baseline/opt-no-rounding.test b/test/baseline/opt-no-rounding.test
index e69de29b..5d0758c6 100644
--- a/test/baseline/opt-no-rounding.test
+++ b/test/baseline/opt-no-rounding.test
@@ -0,0 +1,81 @@
+2012-01-01 * Opening balance
+ Assets:Current 17.43 EUR
+ Assets:Investments 200 "LU02" @ 24.77 EUR
+ Assets:Investments 58 "LU02" @ 24.79900855 EUR
+ Equity:Opening balance
+
+2012-01-01 * Opening balance
+ Assets:Pension 785.44 GBP
+ Assets:Pension 97.0017 "H2" @ 5.342999720204 GBP
+ Assets:Pension 4.3441 "H1" @ 5.289999915108 GBP
+ Equity:Opening balance
+
+2012-01-01 * Opening balance: misc
+ Assets:Piggy bank 3.51 GBP
+ Equity:Opening balance
+
+2012-01-01 * Opening balance
+ Assets:Rewards 9836 AAdvantage
+ Equity:Opening balance
+
+2012-01-03 * Receivable
+ Assets:Current
+ Assets:Receivable -161.06 EUR
+ Assets:Receivable -9.99 GBP @@ 11.65 EUR
+
+2012-01-27 * Test
+ Income:Test -2759.50 GBP
+ Income:Test -110.76 GBP
+ Assets:Foo 345.57 GBP
+ Expenses:Test 16.47 GBP
+ Expenses:Test 6.33 GBP
+ Expenses:Test 261.39 GBP
+ Assets:Current
+
+test reg -X EUR -H --no-rounding
+12-Jan-01 Opening balance Assets:Current 17.43 EUR 17.43 EUR
+ Assets:Investments 4959.80 EUR 4977.23 EUR
+ Assets:Investments 1438.34 EUR 6415.57 EUR
+ Equity:Opening balance -6409.77 EUR 5.80 EUR
+12-Jan-01 Opening balance Assets:Pension 785.44 GBP 5.80 EUR
+ 785.44 GBP
+ Assets:Pension 97.0017 H2 5.80 EUR
+ 785.44 GBP
+ 97.0017 H2
+ Assets:Pension 4.3441 H1 5.80 EUR
+ 785.44 GBP
+ 4.3441 H1
+ 97.0017 H2
+ Equity:Opening balance -1326.70 GBP 5.80 EUR
+ -541.26 GBP
+ 4.3441 H1
+ 97.0017 H2
+12-Jan-01 Opening balance: misc Assets:Piggy bank 3.51 GBP 5.80 EUR
+ -537.75 GBP
+ 4.3441 H1
+ 97.0017 H2
+ Equity:Opening balance -3.51 GBP 5.80 EUR
+ -541.26 GBP
+ 4.3441 H1
+ 97.0017 H2
+12-Jan-01 Opening balance Assets:Rewards 9836 AAdvantage 9836 AAdvantage
+ 5.80 EUR
+ -541.26 GBP
+ 4.3441 H1
+ 97.0017 H2
+ Equity:Opening balance -9836 AAdvantage 5.80 EUR
+ -541.26 GBP
+ 4.3441 H1
+ 97.0017 H2
+12-Jan-03 Commodities revalued <Revalued> 0 5.80 EUR
+12-Jan-03 Receivable Assets:Current 172.71 EUR 178.51 EUR
+ Assets:Receivable -161.06 EUR 17.45 EUR
+ Assets:Receivable -11.65 EUR 5.80 EUR
+12-Jan-27 Test Income:Test -3218.04 EUR -3212.23 EUR
+ Income:Test -129.16 EUR -3341.40 EUR
+ Assets:Foo 402.99 EUR -2938.41 EUR
+ Expenses:Test 19.21 EUR -2919.20 EUR
+ Expenses:Test 7.38 EUR -2911.82 EUR
+ Expenses:Test 304.82 EUR -2606.99 EUR
+ Assets:Current 2612.80 EUR 5.80 EUR
+end test
diff --git a/test/baseline/opt-no-titles.test b/test/baseline/opt-no-titles.test
index e69de29b..40a9b421 100644
--- a/test/baseline/opt-no-titles.test
+++ b/test/baseline/opt-no-titles.test
@@ -0,0 +1,10 @@
+test reg -f test/input/drewr3.dat --no-titles --group-by payee reg food
+11-Jan-02 Grocery Store Expense:Food:Groceries $ 65.00 $ 65.00
+11-Jan-19 Grocery Store Expense:Food:Groceries $ 44.00 $ 109.00
+10-Dec-20 Organic Co-op Expense:Food:Groceries $ 37.50 $ 37.50
+ Expense:Food:Groceries $ 37.50 $ 75.00
+ Expense:Food:Groceries $ 37.50 $ 112.50
+ Expense:Food:Groceries $ 37.50 $ 150.00
+ Expense:Food:Groceries $ 37.50 $ 187.50
+ Expense:Food:Groceries $ 37.50 $ 225.00
+end test
diff --git a/test/baseline/opt-permissive.test b/test/baseline/opt-permissive.test
index e69de29b..8f8ff031 100644
--- a/test/baseline/opt-permissive.test
+++ b/test/baseline/opt-permissive.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/baseline/opt-price-db.dat b/test/baseline/opt-price-db.dat
new file mode 100644
index 00000000..abc51a0a
--- /dev/null
+++ b/test/baseline/opt-price-db.dat
@@ -0,0 +1,2 @@
+P 2012-03-16 06:47:12 CAD $2.50
+P 2012-03-17 06:47:12 CAD $3.50
diff --git a/test/baseline/opt-price-db.test b/test/baseline/opt-price-db.test
new file mode 100644
index 00000000..06021e4a
--- /dev/null
+++ b/test/baseline/opt-price-db.test
@@ -0,0 +1,8 @@
+2012-03-17 KFC
+ Expenses:Food 20 CAD
+ Assets:Cash
+
+test pricedb --price-db test/baseline/opt-price-db.dat
+P 2012/03/16 06:47:12 CAD $2.5
+P 2012/03/17 06:47:12 CAD $3.5
+end test
diff --git a/test/baseline/opt-rich-data.test b/test/baseline/opt-rich-data.test
index fbb73ebe..265af531 100644
--- a/test/baseline/opt-rich-data.test
+++ b/test/baseline/opt-rich-data.test
@@ -1,3 +1,13 @@
+test -f /dev/null convert test/baseline/feat-convert-with-directives.dat --now '2014/08/01'
+2012/01/01 * KFC
+ Expenses:Unknown $10
+ Equity:Unknown
+
+2012/01/02 * REWE SAGT DANKE 123454321
+ Expenses:Unknown 10€
+ Equity:Unknown
+end test
+
test -f /dev/null convert test/baseline/feat-convert-with-directives.dat --detail --now '2014/08/01'
2012/01/01 * KFC
; CSV: 2012/01/01,KFC,$10
diff --git a/test/baseline/opt-script.dat b/test/baseline/opt-script.dat
new file mode 100644
index 00000000..ac6085d5
--- /dev/null
+++ b/test/baseline/opt-script.dat
@@ -0,0 +1,3 @@
+--no-pager --columns=80 bal
+--no-pager --columns=80 reg
+--no-pager --columns=80 print
diff --git a/test/baseline/opt-script.test b/test/baseline/opt-script.test
new file mode 100644
index 00000000..041c15ee
--- /dev/null
+++ b/test/baseline/opt-script.test
@@ -0,0 +1,15 @@
+2012-03-17 KFC
+ Expenses:Food 20 CAD
+ Assets:Cash
+
+test --script test/baseline/opt-script.dat
+ -20 CAD Assets:Cash
+ 20 CAD Expenses:Food
+--------------------
+ 0
+12-Mar-17 KFC Expenses:Food 20 CAD 20 CAD
+ Assets:Cash -20 CAD 0
+2012/03/17 KFC
+ Expenses:Food 20 CAD
+ Assets:Cash
+end test
diff --git a/test/baseline/opt-value-expr.test b/test/baseline/opt-value-expr.test
index e69de29b..8b68a80e 100644
--- a/test/baseline/opt-value-expr.test
+++ b/test/baseline/opt-value-expr.test
@@ -0,0 +1,48 @@
+
+D 1000.00 EUR
+D 1000.00 USD
+D 1000.00 DM
+
+2015-01-01 * Buy 2 FOO
+ Assets:Investments 2 FOO @@ 20.00 EUR
+ Assets:Cash -20.00 EUR
+
+2015-05-01 * Spend on food
+ Expenses:Food 20.00 USD
+ ; Just to be silly, always valuate *these* $20 as 30 DM, no matter what
+ ; the user asks for with -V or -X
+ ; VALUE:: 30 DM
+ Assets:Cash -20.00 USD
+
+P 2015-05-01 USD 20 DM
+
+P 2015-06-01 USD 22 DM
+
+test bal assets:investments -V --value-expr "25.00 EUR"
+ 50.00 EUR Assets:Investments
+end test
+
+test bal assets:investments -G --value-expr "date < [March 2015] ? 22.00 EUR : 25.00 EUR" --now "2015-02-20"
+ 24.00 EUR Assets:Investments
+end test
+
+test bal assets:investments -G --value-expr "date < [March 2015] ? 22.00 EUR : 25.00 EUR" --now "2015-03-20"
+ 30.00 EUR Assets:Investments
+end test
+
+test bal expenses:food
+ 20.00 USD Expenses:Food
+end test
+
+test bal expenses:food -V
+ 600.00 DM Expenses:Food
+end test
+
+test bal expenses:food -X "DM" --now "2015-05-02"
+ 600.00 DM Expenses:Food
+end test
+
+test bal expenses:food -X "DM" --now "2015-06-02"
+ 600.00 DM Expenses:Food
+end test
+
diff --git a/test/baseline/opt-values.test b/test/baseline/opt-values.test
new file mode 100644
index 00000000..35eeeaf6
--- /dev/null
+++ b/test/baseline/opt-values.test
@@ -0,0 +1,6 @@
+test tags -f test/input/drewr3.dat --values
+hastag: not block
+hastag: true
+nestedtag: true
+nobudget
+end test
diff --git a/test/baseline/opt-verify-memory.test b/test/baseline/opt-verify-memory.test
deleted file mode 100644
index e69de29b..00000000
--- a/test/baseline/opt-verify-memory.test
+++ /dev/null
diff --git a/test/regress/1102.test b/test/regress/1102.test
new file mode 100644
index 00000000..259b2883
--- /dev/null
+++ b/test/regress/1102.test
@@ -0,0 +1,8 @@
+2015/01/15 * Grocery Store
+ Assets:Cash ¤ -5,00
+ Expenses:Food
+
+test -i /dev/null reg
+15-Jan-15 Grocery Store Assets:Cash ¤ -5,00 ¤ -5,00
+ Expenses:Food ¤ 5,00 0
+end test
diff --git a/test/regress/1106.test b/test/regress/1106.test
new file mode 100644
index 00000000..c6b41071
--- /dev/null
+++ b/test/regress/1106.test
@@ -0,0 +1,11 @@
+2015/01/20 Payee
+ Assets:Cash ¤ 12,34
+ Expenses:Food
+
+test -F "»%(trim(' Trimmed '))«\n" reg expenses
+»Trimmed«
+end test
+
+test -F "»%(trim('Trimmed'))«\n" reg expenses
+»Trimmed«
+end test
diff --git a/test/regress/25A099C9.test b/test/regress/25A099C9.test
new file mode 100644
index 00000000..cfc0eabd
--- /dev/null
+++ b/test/regress/25A099C9.test
@@ -0,0 +1,61 @@
+test -f test/garbage-input.dat reg -> 29
+__ERROR__
+While parsing file "$sourcepath/test/garbage-input.dat", line 1:
+Error: Directive '/*' requires an argument
+While parsing file "$sourcepath/test/garbage-input.dat", line 32:
+Error: Directive '/**' requires an argument
+While parsing file "$sourcepath/test/garbage-input.dat", line 36:
+Error: Directive '/**' requires an argument
+While parsing file "$sourcepath/test/garbage-input.dat", line 66:
+Error: No quantity specified for amount
+While parsing file "$sourcepath/test/garbage-input.dat", line 69:
+Error: Unexpected whitespace at beginning of line
+While parsing file "$sourcepath/test/garbage-input.dat", line 78:
+Error: Directive '};' requires an argument
+While parsing file "$sourcepath/test/garbage-input.dat", line 82:
+Error: Directive '/**' requires an argument
+While parsing file "$sourcepath/test/garbage-input.dat", line 93:
+Error: Unexpected whitespace at beginning of line
+While parsing file "$sourcepath/test/garbage-input.dat", line 97:
+Error: Directive '{' requires an argument
+While parsing file "$sourcepath/test/garbage-input.dat", line 98:
+Error: Directive 'public:' requires an argument
+While parsing file "$sourcepath/test/garbage-input.dat", line 120:
+Error: Directive 'protected:' requires an argument
+While parsing file "$sourcepath/test/garbage-input.dat", line 131:
+Error: Directive 'public:' requires an argument
+While parsing file "$sourcepath/test/garbage-input.dat", line 711:
+Error: Unexpected whitespace at beginning of line
+While parsing file "$sourcepath/test/garbage-input.dat", line 740:
+Error: Directive 'private:' requires an argument
+While parsing file "$sourcepath/test/garbage-input.dat", line 749:
+Error: Unexpected whitespace at beginning of line
+While parsing file "$sourcepath/test/garbage-input.dat", line 750:
+Error: Directive '};' requires an argument
+While parsing file "$sourcepath/test/garbage-input.dat", line 752:
+Error: Invalid date/time: line amount_t amoun
+While parsing file "$sourcepath/test/garbage-input.dat", line 756:
+Error: Directive '}' requires an argument
+While parsing file "$sourcepath/test/garbage-input.dat", line 758:
+Error: Invalid date/time: line string amount_
+While parsing file "$sourcepath/test/garbage-input.dat", line 762:
+Error: Directive '}' requires an argument
+While parsing file "$sourcepath/test/garbage-input.dat", line 764:
+Error: Invalid date/time: line string amount_
+While parsing file "$sourcepath/test/garbage-input.dat", line 768:
+Error: Directive '}' requires an argument
+While parsing file "$sourcepath/test/garbage-input.dat", line 770:
+Error: Invalid date/time: line string amount_
+While parsing file "$sourcepath/test/garbage-input.dat", line 774:
+Error: Directive '}' requires an argument
+While parsing file "$sourcepath/test/garbage-input.dat", line 776:
+Error: Invalid date/time: line std::ostream&
+While parsing file "$sourcepath/test/garbage-input.dat", line 782:
+Error: Directive '}' requires an argument
+While parsing file "$sourcepath/test/garbage-input.dat", line 783:
+Error: Invalid date/time: line std::istream&
+While parsing file "$sourcepath/test/garbage-input.dat", line 786:
+Error: Directive '}' requires an argument
+While parsing file "$sourcepath/test/garbage-input.dat", line 789:
+Error: Unexpected whitespace at beginning of line
+end test
diff --git a/test/regress/25A099C9.test.disable b/test/regress/25A099C9.test.disable
deleted file mode 100644
index e511c799..00000000
--- a/test/regress/25A099C9.test.disable
+++ /dev/null
@@ -1,43 +0,0 @@
-test -f test/garbage-input.dat reg -> 20
-__ERROR__
-While parsing file "$sourcepath/test/garbage-input.dat", line 2:
-Error: Unexpected whitespace at beginning of line
-While parsing file "$sourcepath/test/garbage-input.dat", line 33:
-Error: Unexpected whitespace at beginning of line
-While parsing file "$sourcepath/test/garbage-input.dat", line 37:
-Error: Unexpected whitespace at beginning of line
-While parsing file "$sourcepath/test/garbage-input.dat", line 66:
-Error: No quantity specified for amount
-While parsing file "$sourcepath/test/garbage-input.dat", line 69:
-Error: Unexpected whitespace at beginning of line
-While parsing file "$sourcepath/test/garbage-input.dat", line 83:
-Error: Unexpected whitespace at beginning of line
-While parsing file "$sourcepath/test/garbage-input.dat", line 93:
-Error: Unexpected whitespace at beginning of line
-While parsing file "$sourcepath/test/garbage-input.dat", line 99:
-Error: Unexpected whitespace at beginning of line
-While parsing file "$sourcepath/test/garbage-input.dat", line 121:
-Error: Unexpected whitespace at beginning of line
-While parsing file "$sourcepath/test/garbage-input.dat", line 132:
-Error: Unexpected whitespace at beginning of line
-While parsing file "$sourcepath/test/garbage-input.dat", line 711:
-Error: Unexpected whitespace at beginning of line
-While parsing file "$sourcepath/test/garbage-input.dat", line 741:
-Error: Unexpected whitespace at beginning of line
-While parsing file "$sourcepath/test/garbage-input.dat", line 749:
-Error: Unexpected whitespace at beginning of line
-While parsing file "$sourcepath/test/garbage-input.dat", line 752:
-Error: Invalid date/time: line amount_t amoun
-While parsing file "$sourcepath/test/garbage-input.dat", line 758:
-Error: Invalid date/time: line string amount_
-While parsing file "$sourcepath/test/garbage-input.dat", line 764:
-Error: Invalid date/time: line string amount_
-While parsing file "$sourcepath/test/garbage-input.dat", line 770:
-Error: Invalid date/time: line string amount_
-While parsing file "$sourcepath/test/garbage-input.dat", line 776:
-Error: Invalid date/time: line std::ostream&
-While parsing file "$sourcepath/test/garbage-input.dat", line 783:
-Error: Invalid date/time: line std::istream&
-While parsing file "$sourcepath/test/garbage-input.dat", line 789:
-Error: Unexpected whitespace at beginning of line
-end test
diff --git a/test/regress/634AA589.test b/test/regress/634AA589.test
deleted file mode 100644
index 8f8ff031..00000000
--- a/test/regress/634AA589.test
+++ /dev/null
@@ -1,19 +0,0 @@
-
-; 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/unit/CMakeLists.txt b/test/unit/CMakeLists.txt
index 8d13d2d6..de7fdd26 100644
--- a/test/unit/CMakeLists.txt
+++ b/test/unit/CMakeLists.txt
@@ -7,9 +7,16 @@ include_directories(${PROJECT_SOURCE_DIR}/src)
if (BUILD_LIBRARY)
add_executable(UtilTests t_times.cc)
+ if (CMAKE_SYSTEM_NAME STREQUAL Darwin AND HAVE_BOOST_PYTHON)
+ target_link_libraries(UtilTests ${PYTHON_LIBRARIES})
+ endif()
add_ledger_test(UtilTests)
add_executable(MathTests t_amount.cc t_commodity.cc t_balance.cc t_expr.cc t_value.cc)
+ set_source_files_properties(t_amount.cc PROPERTIES COMPILE_FLAGS "-Wno-unused-comparison")
+ if (CMAKE_SYSTEM_NAME STREQUAL Darwin AND HAVE_BOOST_PYTHON)
+ target_link_libraries(MathTests ${PYTHON_LIBRARIES})
+ endif()
add_ledger_test(MathTests)
set_target_properties(check PROPERTIES DEPENDS LedgerUtilTests)
diff --git a/test/unit/t_balance.cc b/test/unit/t_balance.cc
index c4ec2f31..b503d02a 100644
--- a/test/unit/t_balance.cc
+++ b/test/unit/t_balance.cc
@@ -178,7 +178,10 @@ BOOST_AUTO_TEST_CASE(testEqaulity)
BOOST_CHECK(b4 == b5);
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-value"
BOOST_CHECK_THROW(b0 == a0, balance_error);
+#pragma GCC diagnostic pop
BOOST_CHECK(b0.valid());
BOOST_CHECK(b1.valid());