cmark

My personal build of CMark ✏️

Commit
05dac79983ac1897a0908d49e782bffe307252ae
Parent
940b204d7e23ea2cc6d8987e0a55e13040c901c2
Author
John MacFarlane <jgm@berkeley.edu>
Date

spec_test.py - parameterize do_test with converter.

Diffstat

1 file changed, 4 insertions, 4 deletions

Status File Name N° Changes Insertions Deletions
Modified test/spec_tests.py 8 4 4
diff --git a/test/spec_tests.py b/test/spec_tests.py
@@ -38,8 +38,8 @@ def out(str):
 def print_test_header(headertext, example_number, start_line, end_line):
     out("Example %d (lines %d-%d) %s\n" % (example_number,start_line,end_line,headertext))
 
-def do_test(test, normalize, result_counts):
-    [retcode, actual_html, err] = cmark.to_html(test['markdown'])
+def do_test(converter, test, normalize, result_counts):
+    [retcode, actual_html, err] = converter(test['markdown'])
     if retcode == 0:
         expected_html = test['html']
         unicode_error = None
@@ -135,9 +135,9 @@ if __name__ == "__main__":
         exit(0)
     else:
         skipped = len(all_tests) - len(tests)
-        cmark = CMark(prog=args.program, library_dir=args.library_dir)
+        converter = CMark(prog=args.program, library_dir=args.library_dir).to_html
         result_counts = {'pass': 0, 'fail': 0, 'error': 0, 'skip': skipped}
         for test in tests:
-            do_test(test, args.normalize, result_counts)
+            do_test(converter, test, args.normalize, result_counts)
         out("{pass} passed, {fail} failed, {error} errored, {skip} skipped\n".format(**result_counts))
         exit(result_counts['fail'] + result_counts['error'])