From 7e7ff1b9f109b1c06f660030221c53b3ad309c3f Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Fri, 29 May 2015 19:50:02 -0300 Subject: content-parser: fixed inline parser --- tests/check_content_parser.c | 70 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/check_content_parser.c b/tests/check_content_parser.c index 9ed8a0e..d549de9 100644 --- a/tests/check_content_parser.c +++ b/tests/check_content_parser.c @@ -749,10 +749,33 @@ test_content_parse_inline_link(void **state) assert_non_null(html); assert_string_equal(html, "bola\n"); free(html); - // invalid html = blogc_content_parse_inline("[bola](http://example.org/\n"); assert_non_null(html); - assert_string_equal(html, ""); // FIXME + assert_string_equal(html, "[bola](http://example.org/\n"); + free(html); + html = blogc_content_parse_inline("["); + assert_non_null(html); + assert_string_equal(html, "["); + free(html); + html = blogc_content_parse_inline("[\n"); + assert_non_null(html); + assert_string_equal(html, "[\n"); + free(html); + html = blogc_content_parse_inline("[a"); + assert_non_null(html); + assert_string_equal(html, "[a"); + free(html); + html = blogc_content_parse_inline("[a\n"); + assert_non_null(html); + assert_string_equal(html, "[a\n"); + free(html); + html = blogc_content_parse_inline("[a]"); + assert_non_null(html); + assert_string_equal(html, "[a]"); + free(html); + html = blogc_content_parse_inline("[a]\n"); + assert_non_null(html); + assert_string_equal(html, "[a]\n"); free(html); } @@ -781,10 +804,49 @@ test_content_parse_inline_image(void **state) assert_non_null(html); assert_string_equal(html, "\"bola\"\n"); free(html); - // invalid html = blogc_content_parse_inline("![bola](http://example.org/\n"); assert_non_null(html); - assert_string_equal(html, ""); // FIXME + assert_string_equal(html, "![bola](http://example.org/\n"); + free(html); + html = blogc_content_parse_inline("!"); + assert_non_null(html); + assert_string_equal(html, "!"); + free(html); + html = blogc_content_parse_inline("!["); + assert_non_null(html); + assert_string_equal(html, "!["); + free(html); + html = blogc_content_parse_inline("!\n"); + assert_non_null(html); + assert_string_equal(html, "!\n"); + free(html); + html = blogc_content_parse_inline("![\n"); + assert_non_null(html); + assert_string_equal(html, "![\n"); + free(html); + html = blogc_content_parse_inline("![a"); + assert_non_null(html); + assert_string_equal(html, "![a"); + free(html); + html = blogc_content_parse_inline("!a\n"); + assert_non_null(html); + assert_string_equal(html, "!a\n"); + free(html); + html = blogc_content_parse_inline("![a\n"); + assert_non_null(html); + assert_string_equal(html, "![a\n"); + free(html); + html = blogc_content_parse_inline("![a]"); + assert_non_null(html); + assert_string_equal(html, "![a]"); + free(html); + html = blogc_content_parse_inline("!a]\n"); + assert_non_null(html); + assert_string_equal(html, "!a]\n"); + free(html); + html = blogc_content_parse_inline("![a]\n"); + assert_non_null(html); + assert_string_equal(html, "![a]\n"); free(html); } -- cgit v1.2.3-18-g5258