summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2016-06-02 09:57:01 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2016-06-02 09:57:01 -0700
commit05dac79983ac1897a0908d49e782bffe307252ae (patch)
tree0ee97b79e80d2f83eb3d01371286e56999ec0c73
parent940b204d7e23ea2cc6d8987e0a55e13040c901c2 (diff)
spec_test.py - parameterize do_test with converter.
-rwxr-xr-xtest/spec_tests.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/spec_tests.py b/test/spec_tests.py
index 365ff75..9974fe0 100755
--- 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'])