diff options
author | John Wiegley <johnw@newartisans.com> | 2010-06-23 19:31:06 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-06-23 19:31:06 -0400 |
commit | eda6cbd0146d371653feec70e0eb3ee4e4c56379 (patch) | |
tree | aeb4e1ace0f9b284789f66f3ceb30bed66946b93 /test/CheckTests.py | |
parent | 014fde3418783d1ee1ec7fe4ea6c8b04ae7f6cd8 (diff) | |
parent | 93807fade69dd4f0ec575eda78fe1a77a85c24e3 (diff) | |
download | fork-ledger-eda6cbd0146d371653feec70e0eb3ee4e4c56379.tar.gz fork-ledger-eda6cbd0146d371653feec70e0eb3ee4e4c56379.tar.bz2 fork-ledger-eda6cbd0146d371653feec70e0eb3ee4e4c56379.zip |
Merge branch 'next'
Diffstat (limited to 'test/CheckTests.py')
-rwxr-xr-x | test/CheckTests.py | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/test/CheckTests.py b/test/CheckTests.py new file mode 100755 index 00000000..1a364ff4 --- /dev/null +++ b/test/CheckTests.py @@ -0,0 +1,87 @@ +#!/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) |