summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-11-29 22:34:56 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-11-29 22:34:56 -0800
commita17f54ca246ed607f02c165b916b17aa0be03492 (patch)
treebb2c26e94b1c5a8a4d451f211b071711d46dcc5f
parentf85e4d89559d396d90e822d5876e3833fdfb69d6 (diff)
More code cleanup in spec_tests.py.
-rwxr-xr-xtest/spec_tests.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/test/spec_tests.py b/test/spec_tests.py
index 8abc835..4873632 100755
--- a/test/spec_tests.py
+++ b/test/spec_tests.py
@@ -30,9 +30,6 @@ if __name__ == "__main__":
default=False, help='filter stdin through normalizer for testing')
args = parser.parse_args(sys.argv[1:])
-if not args.dump_tests:
- cmark = CMark(prog=args.program, library_dir=args.library_dir)
-
def print_test_header(headertext, example_number, start_line, end_line):
print "Example %d (lines %d-%d) %s" % (example_number,start_line,end_line,headertext)
@@ -103,7 +100,7 @@ def get_tests(specfile):
html_lines.append(line)
return tests
-def do_tests(tests, pattern, normalize):
+def do_tests(cmark, tests, pattern, normalize):
passed = 0
errored = 0
failed = 0
@@ -135,7 +132,9 @@ if __name__ == "__main__":
if args.dump_tests:
print json.dumps(tests, ensure_ascii=False, indent=2)
exit(0)
- elif do_tests(tests, args.pattern, args.normalize):
- exit(0)
else:
- exit(1)
+ cmark = CMark(prog=args.program, library_dir=args.library_dir)
+ if do_tests(cmark, tests, args.pattern, args.normalize):
+ exit(0)
+ else:
+ exit(1)