aboutsummaryrefslogtreecommitdiffstats
path: root/tests/check_content_parser.c
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2016-01-30 22:45:46 +0100
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2016-01-30 22:45:46 +0100
commitc4d19f731dc683c5a65327d99f2b416d4781f00b (patch)
tree09e8941c5ac840b2a74ca28e5a474b7746e5fe79 /tests/check_content_parser.c
parent008c96d6518125f2683c1b4e842ca3ed6e865c3d (diff)
parent3b0ea0a4908f1702308354ec7cbd8db5c80f87ee (diff)
downloadblogc-c4d19f731dc683c5a65327d99f2b416d4781f00b.tar.gz
blogc-c4d19f731dc683c5a65327d99f2b416d4781f00b.tar.bz2
blogc-c4d19f731dc683c5a65327d99f2b416d4781f00b.zip
Merge remote-tracking branch 'origin/master' into feature/directives
Diffstat (limited to 'tests/check_content_parser.c')
-rw-r--r--tests/check_content_parser.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/tests/check_content_parser.c b/tests/check_content_parser.c
index 817edba..165810d 100644
--- a/tests/check_content_parser.c
+++ b/tests/check_content_parser.c
@@ -1,6 +1,6 @@
/*
* blogc: A blog compiler.
- * Copyright (C) 2015 Rafael G. Martins <rafael@rafaelmartins.eng.br>
+ * Copyright (C) 2015-2016 Rafael G. Martins <rafael@rafaelmartins.eng.br>
*
* This program can be distributed under the terms of the BSD License.
* See the file LICENSE.
@@ -50,6 +50,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));
@@ -88,7 +99,7 @@ test_content_parse(void **state)
"> \n"
"> asd\n"
"\n"
- " bola\n"
+ " <asd>bola</asd>\n"
" asd\n"
" qwewer\n"
"\n"
@@ -123,7 +134,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"
@@ -166,7 +177,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"
@@ -201,7 +212,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"
@@ -2607,6 +2618,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),