aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2016-01-22 19:29:57 +0100
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2016-01-22 19:30:47 +0100
commitcb132cf02e57f57f4507fbc0126481629d83f209 (patch)
treeb6f77c8cb4033b2c0b84d12443444d0e2efff979 /tests
parent06d8ca94860f4a795995d811cef477969baa2331 (diff)
downloadblogc-cb132cf02e57f57f4507fbc0126481629d83f209.tar.gz
blogc-cb132cf02e57f57f4507fbc0126481629d83f209.tar.bz2
blogc-cb132cf02e57f57f4507fbc0126481629d83f209.zip
content-parser: encode html entities found in code blocks (fixes #3)
Diffstat (limited to 'tests')
-rw-r--r--tests/check_content_parser.c20
1 files changed, 16 insertions, 4 deletions
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
@@ -49,6 +49,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 &amp; &lt; &gt; &quot; &#x27;sfd&#x2F;gf");
+ free(s);
+}
+
+
+static void
test_is_ordered_list_item(void **state)
{
assert_true(blogc_is_ordered_list_item("1.bola", 2));
@@ -87,7 +98,7 @@ test_content_parse(void **state)
"> \n"
"> asd\n"
"\n"
- " bola\n"
+ " <asd>bola</asd>\n"
" asd\n"
" qwewer\n"
"\n"
@@ -122,7 +133,7 @@ test_content_parse(void **state)
"buga</p>\n"
"<pre><code>asd</code></pre>\n"
"</blockquote>\n"
- "<pre><code>bola\n"
+ "<pre><code>&lt;asd&gt;bola&lt;&#x2F;asd&gt;\n"
" asd\n"
"qwewer</code></pre>\n"
"<hr />\n"
@@ -165,7 +176,7 @@ test_content_parse_crlf(void **state)
"> \r\n"
"> asd\r\n"
"\r\n"
- " bola\r\n"
+ " <asd>bola</asd>\r\n"
" asd\r\n"
" qwewer\r\n"
"\r\n"
@@ -200,7 +211,7 @@ test_content_parse_crlf(void **state)
"buga</p>\r\n"
"<pre><code>asd</code></pre>\r\n"
"</blockquote>\r\n"
- "<pre><code>bola\r\n"
+ "<pre><code>&lt;asd&gt;bola&lt;&#x2F;asd&gt;\r\n"
" asd\r\n"
"qwewer</code></pre>\r\n"
"<hr />\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),