cmark

My personal build of CMark ✏️

Commit
7bd74a60747c2c49f5bd498707be5c4a3313842e
Parent
8011e3a9e68262db3a05977d58be25fe2d171954
Author
John MacFarlane <jgm@berkeley.edu>
Date

Updated spec_tests.py from jgm/CommonMark.

This forces utf-8 encoding.

Diffstat

1 file changed, 3 insertions, 3 deletions

Status File Name N° Changes Insertions Deletions
Modified test/spec_tests.py 6 3 3
diff --git a/test/spec_tests.py b/test/spec_tests.py
@@ -52,7 +52,7 @@ def do_test(test, normalize, result_counts):
             result_counts['pass'] += 1
         else:
             print_test_header(test['section'], test['example'], test['start_line'], test['end_line'])
-            sys.stdout.write(test['markdown'])
+            sys.stdout.buffer.write(test['markdown'].encode('utf-8'))
             if unicode_error:
                 print("Unicode error: " + str(unicode_error))
                 print("Expected: " + repr(expected_html))
@@ -62,7 +62,7 @@ def do_test(test, normalize, result_counts):
                 actual_html_lines = actual_html.splitlines(True)
                 for diffline in unified_diff(expected_html_lines, actual_html_lines,
                                 "expected HTML", "actual HTML"):
-                    sys.stdout.write(diffline)
+                    sys.stdout.buffer.write(diffline.encode('utf-8'))
             sys.stdout.write('\n')
             result_counts['fail'] += 1
     else:
@@ -124,7 +124,7 @@ if __name__ == "__main__":
         pattern_re = re.compile('.')
     tests = [ test for test in all_tests if re.search(pattern_re, test['section']) and (not args.number or test['example'] == args.number) ]
     if args.dump_tests:
-        print(json.dumps(tests, ensure_ascii=False, indent=2))
+        sys.stdout.buffer.write(json.dumps(tests, ensure_ascii=False, indent=2).encode('utf-8'))
         exit(0)
     else:
         skipped = len(all_tests) - len(tests)