MCPcopy Create free account
hub / github.com/commonmark/cmark / test_continuation_byte

Function test_continuation_byte

api_test/main.c:812–834  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

810}
811
812static 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
836static void line_endings(test_batch_runner *runner) {
837 // Test list with different line endings

Callers 1

utf8Function · 0.85

Calls 2

cmark_markdown_to_htmlFunction · 0.85
STR_EQFunction · 0.85

Tested by

no test coverage detected