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'])