diff options
Diffstat (limited to 'api_test')
-rw-r--r-- | api_test/main.c | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/api_test/main.c b/api_test/main.c index 61291dc..17e1582 100644 --- a/api_test/main.c +++ b/api_test/main.c @@ -5,7 +5,6 @@ #define CMARK_NO_SHORT_NAMES #include "cmark.h" #include "node.h" -#include "parser.h" #include "harness.h" #include "cplusplus.h" @@ -884,41 +883,6 @@ static void test_feed_across_line_ending(test_batch_runner *runner) { cmark_node_free(document); } -static cmark_node *S_parse_with_fake_total(bufsize_t fake_total, - const char *str, - cmark_err_type *err) { - cmark_parser *parser = cmark_parser_new(CMARK_OPT_DEFAULT); - parser->total_bytes = fake_total; - cmark_parser_feed(parser, str, strlen(str)); - cmark_node *doc = cmark_parser_finish(parser); - *err = cmark_parser_get_error(parser); - cmark_parser_free(parser); - return doc; -} - -static void test_bufsize_overflow(test_batch_runner *runner) { - cmark_node *doc; - cmark_err_type err; - - doc = S_parse_with_fake_total(BUFSIZE_MAX, "a", &err); - OK(runner, doc == NULL, "parse 1 byte after BUFSIZE_MAX bytes fails"); - INT_EQ(runner, err, CMARK_ERR_INPUT_TOO_LARGE, - "parse 1 byte after BUFSIZE_MAX bytes error code"); - - doc = S_parse_with_fake_total(BUFSIZE_MAX - 9, "0123456789", &err); - OK(runner, doc == NULL, "parse 10 byte after BUFSIZE_MAX-9 bytes fails"); - INT_EQ(runner, err, CMARK_ERR_INPUT_TOO_LARGE, - "parse 10 byte after BUFSIZE_MAX-9 bytes error code"); - - doc = S_parse_with_fake_total(BUFSIZE_MAX - 1, "a", &err); - OK(runner, doc != NULL, "parse 1 byte after BUFSIZE_MAX-1 bytes"); - cmark_node_free(doc); - - doc = S_parse_with_fake_total(BUFSIZE_MAX - 10, "0123456789", &err); - OK(runner, doc != NULL, "parse 10 byte after BUFSIZE_MAX-10 bytes"); - cmark_node_free(doc); -} - int main() { int retval; test_batch_runner *runner = test_batch_runner_new(); @@ -944,7 +908,6 @@ int main() { test_cplusplus(runner); test_safe(runner); test_feed_across_line_ending(runner); - test_bufsize_overflow(runner); test_print_summary(runner); retval = test_ok(runner) ? 0 : 1; |