From a17f54ca246ed607f02c165b916b17aa0be03492 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 29 Nov 2014 22:34:56 -0800 Subject: More code cleanup in spec_tests.py. --- test/spec_tests.py | 13 ++++++------- 1 file 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) -- cgit v1.2.3