diff options
author | John MacFarlane <jgm@berkeley.edu> | 2016-06-02 10:50:07 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2016-06-02 10:50:07 -0700 |
commit | e59b38ee67eea5d62066df29edf025f53096f46e (patch) | |
tree | 0129c77ff087b28172301b12171da75b88830bb9 /test/roundtrip_tests.py | |
parent | 8a53ee9b579fef9a75bd25f881827f28739a1f68 (diff) |
roundtrip tests: remove spurious failures.
In the commonmark writer we separate lists, and lists and
indented code, using a dummy HTML comment rather than two
blank lines (this is more portable).
So in evaluating the round-trip tests, we now strip out
these comments.
We also normalize HTML to avoid issues having to do with
line breaks.
Diffstat (limited to 'test/roundtrip_tests.py')
-rw-r--r-- | test/roundtrip_tests.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/roundtrip_tests.py b/test/roundtrip_tests.py index 8becb08..a52aa8d 100644 --- a/test/roundtrip_tests.py +++ b/test/roundtrip_tests.py @@ -1,3 +1,4 @@ +import re import sys from spec_tests import get_tests, do_test from cmark import CMark @@ -26,7 +27,15 @@ def converter(md): cmark = CMark(prog=args.program, library_dir=args.library_dir) [ec, result, err] = cmark.to_commonmark(md) if ec == 0: - return cmark.to_html(result) + [ec, html, err] = cmark.to_html(result) + if ec == 0: + # In the commonmark writer we insert dummy HTML + # comments between lists, and between lists and code + # blocks. Strip these out, since the spec uses + # two blank lines instead: + return [ec, re.sub('<!-- end list -->\n', '', html), ''] + else: + return [ec, html, err] else: return [ec, result, err] |