| 810 | } |
| 811 | |
| 812 | static void test_continuation_byte(test_batch_runner *runner, |
| 813 | const char *utf8) { |
| 814 | size_t len = strlen(utf8); |
| 815 | |
| 816 | for (size_t pos = 1; pos < len; ++pos) { |
| 817 | char buf[20]; |
| 818 | sprintf(buf, "((((%s))))", utf8); |
| 819 | buf[4 + pos] = '\x20'; |
| 820 | |
| 821 | char expected[50]; |
| 822 | strcpy(expected, "<p>((((" UTF8_REPL "\x20"); |
| 823 | for (size_t i = pos + 1; i < len; ++i) { |
| 824 | strcat(expected, UTF8_REPL); |
| 825 | } |
| 826 | strcat(expected, "))))</p>\n"); |
| 827 | |
| 828 | char *html = |
| 829 | cmark_markdown_to_html(buf, strlen(buf), CMARK_OPT_VALIDATE_UTF8); |
| 830 | STR_EQ(runner, html, expected, "invalid utf8 continuation byte %d/%d", pos, |
| 831 | len); |
| 832 | free(html); |
| 833 | } |
| 834 | } |
| 835 | |
| 836 | static void line_endings(test_batch_runner *runner) { |
| 837 | // Test list with different line endings |
no test coverage detected