diff options
author | John Wiegley <johnw@newartisans.com> | 2010-06-15 18:19:54 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-06-15 18:19:54 -0400 |
commit | 35ca4f0bb0e9f94c5627af532bd39e27f6a561db (patch) | |
tree | fc9b7b1a847114b3e255cedf656cdd0a44494256 | |
parent | b6dae554fe9c39b076947a7da83a3a7b01521296 (diff) | |
download | fork-ledger-35ca4f0bb0e9f94c5627af532bd39e27f6a561db.tar.gz fork-ledger-35ca4f0bb0e9f94c5627af532bd39e27f6a561db.tar.bz2 fork-ledger-35ca4f0bb0e9f94c5627af532bd39e27f6a561db.zip |
Ensure that all options are tested and documented
-rwxr-xr-x | test/CheckTests.py | 80 | ||||
-rw-r--r-- | test/baseline/opt-actual-dates.test | 0 | ||||
-rw-r--r-- | test/baseline/opt-budget-format.test | 0 | ||||
-rw-r--r-- | test/baseline/opt-cleared-format.test | 0 | ||||
-rw-r--r-- | test/baseline/opt-count.test | 0 | ||||
-rw-r--r-- | test/baseline/opt-date.test | 0 | ||||
-rw-r--r-- | test/baseline/opt-datetime-format.test | 0 | ||||
-rw-r--r-- | test/baseline/opt-decimal-comma.test | 0 | ||||
-rw-r--r-- | test/baseline/opt-forecast-years.test | 0 | ||||
-rw-r--r-- | test/baseline/opt-generated.test | 0 | ||||
-rw-r--r-- | test/baseline/opt-group-by.test | 0 | ||||
-rw-r--r-- | test/baseline/opt-group-title-format.test | 0 | ||||
-rw-r--r-- | test/baseline/opt-meta-width.test | 0 | ||||
-rw-r--r-- | test/baseline/opt-meta.test | 0 | ||||
-rw-r--r-- | test/baseline/opt-no-rounding.test | 0 | ||||
-rw-r--r-- | test/baseline/opt-no-titles.test | 0 | ||||
-rw-r--r-- | test/baseline/opt-now.test | 0 | ||||
-rw-r--r-- | test/baseline/opt-pivot.test | 0 | ||||
-rw-r--r-- | test/baseline/opt-prepend-format.test | 0 | ||||
-rw-r--r-- | test/baseline/opt-prepend-width.test | 0 | ||||
-rw-r--r-- | tools/Makefile.am | 9 |
21 files changed, 88 insertions, 1 deletions
diff --git a/test/CheckTests.py b/test/CheckTests.py new file mode 100755 index 00000000..225d4a8d --- /dev/null +++ b/test/CheckTests.py @@ -0,0 +1,80 @@ +#!/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', '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/baseline/opt-actual-dates.test b/test/baseline/opt-actual-dates.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-actual-dates.test diff --git a/test/baseline/opt-budget-format.test b/test/baseline/opt-budget-format.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-budget-format.test diff --git a/test/baseline/opt-cleared-format.test b/test/baseline/opt-cleared-format.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-cleared-format.test diff --git a/test/baseline/opt-count.test b/test/baseline/opt-count.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-count.test diff --git a/test/baseline/opt-date.test b/test/baseline/opt-date.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-date.test diff --git a/test/baseline/opt-datetime-format.test b/test/baseline/opt-datetime-format.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-datetime-format.test diff --git a/test/baseline/opt-decimal-comma.test b/test/baseline/opt-decimal-comma.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-decimal-comma.test diff --git a/test/baseline/opt-forecast-years.test b/test/baseline/opt-forecast-years.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-forecast-years.test diff --git a/test/baseline/opt-generated.test b/test/baseline/opt-generated.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-generated.test diff --git a/test/baseline/opt-group-by.test b/test/baseline/opt-group-by.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-group-by.test diff --git a/test/baseline/opt-group-title-format.test b/test/baseline/opt-group-title-format.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-group-title-format.test diff --git a/test/baseline/opt-meta-width.test b/test/baseline/opt-meta-width.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-meta-width.test diff --git a/test/baseline/opt-meta.test b/test/baseline/opt-meta.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-meta.test diff --git a/test/baseline/opt-no-rounding.test b/test/baseline/opt-no-rounding.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-no-rounding.test diff --git a/test/baseline/opt-no-titles.test b/test/baseline/opt-no-titles.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-no-titles.test diff --git a/test/baseline/opt-now.test b/test/baseline/opt-now.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-now.test diff --git a/test/baseline/opt-pivot.test b/test/baseline/opt-pivot.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-pivot.test diff --git a/test/baseline/opt-prepend-format.test b/test/baseline/opt-prepend-format.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-prepend-format.test diff --git a/test/baseline/opt-prepend-width.test b/test/baseline/opt-prepend-width.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-prepend-width.test diff --git a/tools/Makefile.am b/tools/Makefile.am index 0dd4962c..04cec6b0 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -247,7 +247,8 @@ endif ###################################################################### -TESTS = RegressTests BaselineTests ManualTests ConfirmTests GenerateTests +TESTS = RegressTests BaselineTests ManualTests ConfirmTests \ + GenerateTests CheckTests if HAVE_CPPUNIT TESTS += \ @@ -409,6 +410,12 @@ GenerateTests: $(srcdir)/test/GenerateTests.py echo "$(PYTHON) $(srcdir)/test/GenerateTests.py -j$(JOBS) $(top_builddir)/ledger$(EXEEXT) $(srcdir) 1 ${1:-20} \"\$$@\"" > $@ chmod 755 $@ +CheckTests_SOURCES = test/CheckTests.py + +CheckTests: + echo "$(PYTHON) $(srcdir)/test/CheckTests.py $(top_builddir)/ledger$(EXEEXT) $(srcdir) \"\$$@\"" > $@ + chmod 755 $@ + FULLCHECK=$(srcdir)/test/fullcheck.sh if HAVE_CPPUNIT |