cmark

My personal build of CMark ✏️

Commit
a17f54ca246ed607f02c165b916b17aa0be03492
Parent
f85e4d89559d396d90e822d5876e3833fdfb69d6
Author
John MacFarlane <jgm@berkeley.edu>
Date

More code cleanup in spec_tests.py.

Diffstat

1 file changed, 6 insertions, 7 deletions

Status File Name N° Changes Insertions Deletions
Modified test/spec_tests.py 13 6 7
diff --git 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)