From cb132cf02e57f57f4507fbc0126481629d83f209 Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Fri, 22 Jan 2016 19:29:57 +0100 Subject: content-parser: encode html entities found in code blocks (fixes #3) --- tests/check_content_parser.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'tests/check_content_parser.c') diff --git a/tests/check_content_parser.c b/tests/check_content_parser.c index 8ed9520..970ec5c 100644 --- a/tests/check_content_parser.c +++ b/tests/check_content_parser.c @@ -48,6 +48,17 @@ test_slugify(void **state) } +static void +test_htmlentities(void **state) +{ + char *s = blogc_htmlentities(NULL); + assert_null(s); + s = blogc_htmlentities("asdxcv & < > \" 'sfd/gf"); + assert_string_equal(s, "asdxcv & < > " 'sfd/gf"); + free(s); +} + + static void test_is_ordered_list_item(void **state) { @@ -87,7 +98,7 @@ test_content_parse(void **state) "> \n" "> asd\n" "\n" - " bola\n" + " bola\n" " asd\n" " qwewer\n" "\n" @@ -122,7 +133,7 @@ test_content_parse(void **state) "buga

\n" "
asd
\n" "\n" - "
bola\n"
+        "
<asd>bola</asd>\n"
         " asd\n"
         "qwewer
\n" "
\n" @@ -165,7 +176,7 @@ test_content_parse_crlf(void **state) "> \r\n" "> asd\r\n" "\r\n" - " bola\r\n" + " bola\r\n" " asd\r\n" " qwewer\r\n" "\r\n" @@ -200,7 +211,7 @@ test_content_parse_crlf(void **state) "buga

\r\n" "
asd
\r\n" "\r\n" - "
bola\r\n"
+        "
<asd>bola</asd>\r\n"
         " asd\r\n"
         "qwewer
\r\n" "
\r\n" @@ -1663,6 +1674,7 @@ main(void) { const UnitTest tests[] = { unit_test(test_slugify), + unit_test(test_htmlentities), unit_test(test_is_ordered_list_item), unit_test(test_content_parse), unit_test(test_content_parse_crlf), -- cgit v1.2.3-18-g5258