aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2016-04-20 02:50:20 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2016-04-20 02:50:20 +0200
commit9b2a563b4931ca39cd6dd14bf85cda627714a4b2 (patch)
treeafcc5ead7219b0f9f38728eb58c88dfe641325dc
parentc216deff59e2c0dd9538ced99d6b579013b3b5de (diff)
downloadblogc-9b2a563b4931ca39cd6dd14bf85cda627714a4b2.tar.gz
blogc-9b2a563b4931ca39cd6dd14bf85cda627714a4b2.tar.bz2
blogc-9b2a563b4931ca39cd6dd14bf85cda627714a4b2.zip
content-parser: extract post description from content
description is the first line of the first paragraph parsed from content file. users can override it declaring DESCRIPTION variable in source file itself. this also fixes a bug with line endings when using single line blockquotes.
-rw-r--r--src/content-parser.c16
-rw-r--r--src/content-parser.h3
-rw-r--r--src/source-parser.c14
-rw-r--r--tests/check_content_parser.c412
-rw-r--r--tests/check_loader.c3
-rw-r--r--tests/check_source_parser.c46
6 files changed, 389 insertions, 105 deletions
diff --git a/src/content-parser.c b/src/content-parser.c
index 782a85d..795cc34 100644
--- a/src/content-parser.c
+++ b/src/content-parser.c
@@ -460,7 +460,7 @@ blogc_is_ordered_list_item(const char *str, size_t prefix_len)
char*
-blogc_content_parse(const char *src, size_t *end_excerpt)
+blogc_content_parse(const char *src, size_t *end_excerpt, char **description)
{
// src is always nul-terminated.
size_t src_len = strlen(src);
@@ -698,14 +698,10 @@ blogc_content_parse(const char *src, size_t *end_excerpt)
case CONTENT_BLOCKQUOTE_END:
if (c == '\n' || c == '\r' || is_last) {
tmp_str = sb_string_new();
- for (sb_slist_t *l = lines; l != NULL; l = l->next) {
- if (l->next == NULL)
- sb_string_append_printf(tmp_str, "%s", l->data);
- else
- sb_string_append_printf(tmp_str, "%s%s", l->data,
- line_ending);
- }
- tmp = blogc_content_parse(tmp_str->str, NULL);
+ for (sb_slist_t *l = lines; l != NULL; l = l->next)
+ sb_string_append_printf(tmp_str, "%s%s", l->data,
+ line_ending);
+ tmp = blogc_content_parse(tmp_str->str, NULL, description);
sb_string_append_printf(rv, "<blockquote>%s</blockquote>%s",
tmp, line_ending);
free(tmp);
@@ -1019,6 +1015,8 @@ blogc_content_parse(const char *src, size_t *end_excerpt)
state = CONTENT_PARAGRAPH_END;
end = is_last && c != '\n' && c != '\r' ? src_len :
(real_end != 0 ? real_end : current);
+ if (description != NULL && *description == NULL)
+ *description = sb_strndup(src + start, end - start);
}
if (!is_last)
break;
diff --git a/src/content-parser.h b/src/content-parser.h
index 6617bb4..148d5ed 100644
--- a/src/content-parser.h
+++ b/src/content-parser.h
@@ -16,6 +16,7 @@ char* blogc_slugify(const char *str);
char* blogc_htmlentities(const char *str);
char* blogc_content_parse_inline(const char *src);
bool blogc_is_ordered_list_item(const char *str, size_t prefix_len);
-char* blogc_content_parse(const char *src, size_t *end_excerpt);
+char* blogc_content_parse(const char *src, size_t *end_excerpt,
+ char **description);
#endif /* _CONTENT_PARSER_H */
diff --git a/src/source-parser.c b/src/source-parser.c
index 1047f06..6e026d2 100644
--- a/src/source-parser.c
+++ b/src/source-parser.c
@@ -154,7 +154,19 @@ blogc_source_parse(const char *src, size_t src_len, sb_error_t **err)
if (current == (src_len - 1)) {
tmp = sb_strndup(src + start, src_len - start);
sb_trie_insert(rv, "RAW_CONTENT", tmp);
- content = blogc_content_parse(tmp, &end_excerpt);
+ char *description = NULL;
+ content = blogc_content_parse(tmp, &end_excerpt, &description);
+ if (description != NULL) {
+ // do not override source-provided description.
+ if (NULL == sb_trie_lookup(rv, "DESCRIPTION")) {
+ // no need to free, because we are transfering memory
+ // ownership to the trie.
+ sb_trie_insert(rv, "DESCRIPTION", description);
+ }
+ else {
+ free(description);
+ }
+ }
sb_trie_insert(rv, "CONTENT", content);
sb_trie_insert(rv, "EXCERPT", end_excerpt == 0 ?
sb_strdup(content) : sb_strndup(content, end_excerpt));
diff --git a/tests/check_content_parser.c b/tests/check_content_parser.c
index ea3a9a2..0eaab70 100644
--- a/tests/check_content_parser.c
+++ b/tests/check_content_parser.c
@@ -81,6 +81,7 @@ static void
test_content_parse(void **state)
{
size_t l = 0;
+ char *d = NULL;
char *html = blogc_content_parse(
"# um\n"
"## dois\n"
@@ -122,9 +123,11 @@ test_content_parse(void **state)
"\n"
"-- asd\n"
"\n"
- "--- lol\n", &l);
+ "--- lol\n", &l, &d);
assert_non_null(html);
assert_int_equal(l, 0);
+ assert_non_null(d);
+ assert_string_equal(d, "bola");
assert_string_equal(html,
"<h1 id=\"um\">um</h1>\n"
"<h2 id=\"dois\">dois</h2>\n"
@@ -162,6 +165,7 @@ test_content_parse(void **state)
"<p>&ndash; asd</p>\n"
"<p>&mdash; lol</p>\n");
free(html);
+ free(d);
}
@@ -169,6 +173,7 @@ static void
test_content_parse_crlf(void **state)
{
size_t l = 0;
+ char *d = NULL;
char *html = blogc_content_parse(
"# um\r\n"
"## dois\r\n"
@@ -210,9 +215,11 @@ test_content_parse_crlf(void **state)
"\r\n"
"-- asd\r\n"
"\r\n"
- "--- lol\r\n", &l);
+ "--- lol\r\n", &l, &d);
assert_non_null(html);
assert_int_equal(l, 0);
+ assert_non_null(d);
+ assert_string_equal(d, "bola");
assert_string_equal(html,
"<h1 id=\"um\">um</h1>\r\n"
"<h2 id=\"dois\">dois</h2>\r\n"
@@ -250,6 +257,7 @@ test_content_parse_crlf(void **state)
"<p>&ndash; asd</p>\r\n"
"<p>&mdash; lol</p>\r\n");
free(html);
+ free(d);
}
@@ -257,6 +265,7 @@ static void
test_content_parse_with_excerpt(void **state)
{
size_t l = 0;
+ char *d = NULL;
char *html = blogc_content_parse(
"# test\n"
"\n"
@@ -265,9 +274,11 @@ test_content_parse_with_excerpt(void **state)
"..\n"
"\n"
"guda\n"
- "lol", &l);
+ "lol", &l, &d);
assert_non_null(html);
assert_int_equal(l, 38);
+ assert_non_null(d);
+ assert_string_equal(d, "chunda");
assert_string_equal(html,
"<h1 id=\"test\">test</h1>\n"
"<p>chunda</p>\n"
@@ -275,6 +286,8 @@ test_content_parse_with_excerpt(void **state)
"lol</p>\n");
free(html);
l = 0;
+ free(d);
+ d = NULL;
html = blogc_content_parse(
"# test\n"
"\n"
@@ -283,15 +296,18 @@ test_content_parse_with_excerpt(void **state)
"...\n"
"\n"
"guda\n"
- "lol", &l);
+ "lol", &l, &d);
assert_non_null(html);
assert_int_equal(l, 38);
+ assert_non_null(d);
+ assert_string_equal(d, "chunda");
assert_string_equal(html,
"<h1 id=\"test\">test</h1>\n"
"<p>chunda</p>\n"
"<p>guda\n"
"lol</p>\n");
free(html);
+ free(d);
}
@@ -299,6 +315,7 @@ static void
test_content_parse_with_excerpt_crlf(void **state)
{
size_t l = 0;
+ char *d = NULL;
char *html = blogc_content_parse(
"# test\r\n"
"\r\n"
@@ -307,9 +324,11 @@ test_content_parse_with_excerpt_crlf(void **state)
"..\r\n"
"\r\n"
"guda\r\n"
- "lol", &l);
+ "lol", &l, &d);
assert_non_null(html);
assert_int_equal(l, 40);
+ assert_non_null(d);
+ assert_string_equal(d, "chunda");
assert_string_equal(html,
"<h1 id=\"test\">test</h1>\r\n"
"<p>chunda</p>\r\n"
@@ -317,6 +336,8 @@ test_content_parse_with_excerpt_crlf(void **state)
"lol</p>\r\n");
free(html);
l = 0;
+ free(d);
+ d = NULL;
html = blogc_content_parse(
"# test\r\n"
"\r\n"
@@ -325,26 +346,29 @@ test_content_parse_with_excerpt_crlf(void **state)
"...\r\n"
"\r\n"
"guda\r\n"
- "lol", &l);
+ "lol", &l, &d);
assert_non_null(html);
assert_int_equal(l, 40);
+ assert_non_null(d);
+ assert_string_equal(d, "chunda");
assert_string_equal(html,
"<h1 id=\"test\">test</h1>\r\n"
"<p>chunda</p>\r\n"
"<p>guda\r\n"
"lol</p>\r\n");
free(html);
+ free(d);
}
static void
test_content_parse_header(void **state)
{
- char *html = blogc_content_parse("## bola", NULL);
+ char *html = blogc_content_parse("## bola", NULL, NULL);
assert_non_null(html);
assert_string_equal(html, "<h2 id=\"bola\">bola</h2>\n");
free(html);
- html = blogc_content_parse("## bola\n", NULL);
+ html = blogc_content_parse("## bola\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html, "<h2 id=\"bola\">bola</h2>\n");
free(html);
@@ -353,7 +377,7 @@ test_content_parse_header(void **state)
"\n"
"## bola\n"
"\n"
- "guda\n", NULL);
+ "guda\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>bola</p>\n"
@@ -366,11 +390,11 @@ test_content_parse_header(void **state)
static void
test_content_parse_header_crlf(void **state)
{
- char *html = blogc_content_parse("## bola", NULL);
+ char *html = blogc_content_parse("## bola", NULL, NULL);
assert_non_null(html);
assert_string_equal(html, "<h2 id=\"bola\">bola</h2>\n");
free(html);
- html = blogc_content_parse("## bola\r\n", NULL);
+ html = blogc_content_parse("## bola\r\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html, "<h2 id=\"bola\">bola</h2>\r\n");
free(html);
@@ -379,7 +403,7 @@ test_content_parse_header_crlf(void **state)
"\r\n"
"## bola\r\n"
"\r\n"
- "guda\r\n", NULL);
+ "guda\r\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>bola</p>\r\n"
@@ -392,11 +416,11 @@ test_content_parse_header_crlf(void **state)
static void
test_content_parse_html(void **state)
{
- char *html = blogc_content_parse("<div>\n</div>", NULL);
+ char *html = blogc_content_parse("<div>\n</div>", NULL, NULL);
assert_non_null(html);
assert_string_equal(html, "<div>\n</div>\n");
free(html);
- html = blogc_content_parse("<div>\n</div>\n", NULL);
+ html = blogc_content_parse("<div>\n</div>\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html, "<div>\n</div>\n");
free(html);
@@ -406,7 +430,7 @@ test_content_parse_html(void **state)
"<div>\n"
"</div>\n"
"\n"
- "chunda\n", NULL);
+ "chunda\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>bola</p>\n"
@@ -419,11 +443,11 @@ test_content_parse_html(void **state)
static void
test_content_parse_html_crlf(void **state)
{
- char *html = blogc_content_parse("<div>\r\n</div>", NULL);
+ char *html = blogc_content_parse("<div>\r\n</div>", NULL, NULL);
assert_non_null(html);
assert_string_equal(html, "<div>\r\n</div>\r\n");
free(html);
- html = blogc_content_parse("<div>\r\n</div>\r\n", NULL);
+ html = blogc_content_parse("<div>\r\n</div>\r\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html, "<div>\r\n</div>\r\n");
free(html);
@@ -433,7 +457,7 @@ test_content_parse_html_crlf(void **state)
"<div>\r\n"
"</div>\r\n"
"\r\n"
- "chunda\r\n", NULL);
+ "chunda\r\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>bola</p>\r\n"
@@ -446,14 +470,14 @@ test_content_parse_html_crlf(void **state)
static void
test_content_parse_blockquote(void **state)
{
- char *html = blogc_content_parse("> bola\n> guda", NULL);
+ char *html = blogc_content_parse("> bola\n> guda", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<blockquote><p>bola\n"
"guda</p>\n"
"</blockquote>\n");
free(html);
- html = blogc_content_parse("> bola\n> guda\n", NULL);
+ html = blogc_content_parse("> bola\n> guda\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<blockquote><p>bola\n"
@@ -464,9 +488,22 @@ test_content_parse_blockquote(void **state)
"bola\n"
"\n"
"> bola\n"
+ "\n"
+ "chunda\n", NULL, NULL);
+ assert_non_null(html);
+ assert_string_equal(html,
+ "<p>bola</p>\n"
+ "<blockquote><p>bola</p>\n"
+ "</blockquote>\n"
+ "<p>chunda</p>\n");
+ free(html);
+ html = blogc_content_parse(
+ "bola\n"
+ "\n"
+ "> bola\n"
"> guda\n"
"\n"
- "chunda\n", NULL);
+ "chunda\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>bola</p>\n"
@@ -481,14 +518,14 @@ test_content_parse_blockquote(void **state)
static void
test_content_parse_blockquote_crlf(void **state)
{
- char *html = blogc_content_parse("> bola\r\n> guda", NULL);
+ char *html = blogc_content_parse("> bola\r\n> guda", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<blockquote><p>bola\r\n"
"guda</p>\r\n"
"</blockquote>\r\n");
free(html);
- html = blogc_content_parse("> bola\r\n> guda\r\n", NULL);
+ html = blogc_content_parse("> bola\r\n> guda\r\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<blockquote><p>bola\r\n"
@@ -499,9 +536,22 @@ test_content_parse_blockquote_crlf(void **state)
"bola\r\n"
"\r\n"
"> bola\r\n"
+ "\r\n"
+ "chunda\r\n", NULL, NULL);
+ assert_non_null(html);
+ assert_string_equal(html,
+ "<p>bola</p>\r\n"
+ "<blockquote><p>bola</p>\r\n"
+ "</blockquote>\r\n"
+ "<p>chunda</p>\r\n");
+ free(html);
+ html = blogc_content_parse(
+ "bola\r\n"
+ "\r\n"
+ "> bola\r\n"
"> guda\r\n"
"\r\n"
- "chunda\r\n", NULL);
+ "chunda\r\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>bola</p>\r\n"
@@ -516,13 +566,13 @@ test_content_parse_blockquote_crlf(void **state)
static void
test_content_parse_code(void **state)
{
- char *html = blogc_content_parse(" bola\n guda", NULL);
+ char *html = blogc_content_parse(" bola\n guda", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<pre><code>bola\n"
"guda</code></pre>\n");
free(html);
- html = blogc_content_parse(" bola\n guda\n", NULL);
+ html = blogc_content_parse(" bola\n guda\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<pre><code>bola\n"
@@ -534,7 +584,7 @@ test_content_parse_code(void **state)
" bola\n"
" guda\n"
"\n"
- "chunda\n", NULL);
+ "chunda\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>bola</p>\n"
@@ -548,13 +598,13 @@ test_content_parse_code(void **state)
static void
test_content_parse_code_crlf(void **state)
{
- char *html = blogc_content_parse(" bola\r\n guda", NULL);
+ char *html = blogc_content_parse(" bola\r\n guda", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<pre><code>bola\r\n"
"guda</code></pre>\r\n");
free(html);
- html = blogc_content_parse(" bola\r\n guda\r\n", NULL);
+ html = blogc_content_parse(" bola\r\n guda\r\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<pre><code>bola\r\n"
@@ -566,7 +616,7 @@ test_content_parse_code_crlf(void **state)
" bola\r\n"
" guda\r\n"
"\r\n"
- "chunda\r\n", NULL);
+ "chunda\r\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>bola</p>\r\n"
@@ -580,28 +630,28 @@ test_content_parse_code_crlf(void **state)
static void
test_content_parse_horizontal_rule(void **state)
{
- char *html = blogc_content_parse("bola\nguda\n\n**", NULL);
+ char *html = blogc_content_parse("bola\nguda\n\n**", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>bola\n"
"guda</p>\n"
"<hr />\n");
free(html);
- html = blogc_content_parse("bola\nguda\n\n++++", NULL);
+ html = blogc_content_parse("bola\nguda\n\n++++", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>bola\n"
"guda</p>\n"
"<hr />\n");
free(html);
- html = blogc_content_parse("bola\nguda\n\n--\n", NULL);
+ html = blogc_content_parse("bola\nguda\n\n--\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>bola\n"
"guda</p>\n"
"<hr />\n");
free(html);
- html = blogc_content_parse("bola\nguda\n\n****\n", NULL);
+ html = blogc_content_parse("bola\nguda\n\n****\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>bola\n"
@@ -613,7 +663,7 @@ test_content_parse_horizontal_rule(void **state)
"\n"
"**\n"
"\n"
- "chunda\n", NULL);
+ "chunda\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>bola</p>\n"
@@ -625,7 +675,7 @@ test_content_parse_horizontal_rule(void **state)
"\n"
"----\n"
"\n"
- "chunda\n", NULL);
+ "chunda\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>bola</p>\n"
@@ -638,28 +688,28 @@ test_content_parse_horizontal_rule(void **state)
static void
test_content_parse_horizontal_rule_crlf(void **state)
{
- char *html = blogc_content_parse("bola\r\nguda\r\n\r\n**", NULL);
+ char *html = blogc_content_parse("bola\r\nguda\r\n\r\n**", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>bola\r\n"
"guda</p>\r\n"
"<hr />\r\n");
free(html);
- html = blogc_content_parse("bola\r\nguda\r\n\r\n++++", NULL);
+ html = blogc_content_parse("bola\r\nguda\r\n\r\n++++", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>bola\r\n"
"guda</p>\r\n"
"<hr />\r\n");
free(html);
- html = blogc_content_parse("bola\r\nguda\r\n\r\n--\r\n", NULL);
+ html = blogc_content_parse("bola\r\nguda\r\n\r\n--\r\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>bola\r\n"
"guda</p>\r\n"
"<hr />\r\n");
free(html);
- html = blogc_content_parse("bola\r\nguda\r\n\r\n****\r\n", NULL);
+ html = blogc_content_parse("bola\r\nguda\r\n\r\n****\r\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>bola\r\n"
@@ -671,7 +721,7 @@ test_content_parse_horizontal_rule_crlf(void **state)
"\r\n"
"**\r\n"
"\r\n"
- "chunda\r\n", NULL);
+ "chunda\r\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>bola</p>\r\n"
@@ -683,7 +733,7 @@ test_content_parse_horizontal_rule_crlf(void **state)
"\r\n"
"----\r\n"
"\r\n"
- "chunda\r\n", NULL);
+ "chunda\r\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>bola</p>\r\n"
@@ -701,7 +751,7 @@ test_content_parse_unordered_list(void **state)
"\n"
"* asd\n"
"* qwe\n"
- "* zxc", NULL);
+ "* zxc", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>lol</p>\n"
@@ -716,7 +766,7 @@ test_content_parse_unordered_list(void **state)
"\n"
"* asd\n"
"* qwe\n"
- "* zxc\n", NULL);
+ "* zxc\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>lol</p>\n"
@@ -733,7 +783,7 @@ test_content_parse_unordered_list(void **state)
"* qwe\n"
"* zxc\n"
"\n"
- "fuuuu\n", NULL);
+ "fuuuu\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>lol</p>\n"
@@ -753,7 +803,7 @@ test_content_parse_unordered_list(void **state)
"* zxc\n"
" 1234\n"
"\n"
- "fuuuu\n", NULL);
+ "fuuuu\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>lol</p>\n"
@@ -769,7 +819,7 @@ test_content_parse_unordered_list(void **state)
html = blogc_content_parse(
"* asd\n"
"* qwe\n"
- "* zxc", NULL);
+ "* zxc", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<ul>\n"
@@ -789,7 +839,7 @@ test_content_parse_unordered_list_crlf(void **state)
"\r\n"
"* asd\r\n"
"* qwe\r\n"
- "* zxc", NULL);
+ "* zxc", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>lol</p>\r\n"
@@ -804,7 +854,7 @@ test_content_parse_unordered_list_crlf(void **state)
"\r\n"
"* asd\r\n"
"* qwe\r\n"
- "* zxc\r\n", NULL);
+ "* zxc\r\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>lol</p>\r\n"
@@ -821,7 +871,7 @@ test_content_parse_unordered_list_crlf(void **state)
"* qwe\r\n"
"* zxc\r\n"
"\r\n"
- "fuuuu\r\n", NULL);
+ "fuuuu\r\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>lol</p>\r\n"
@@ -841,7 +891,7 @@ test_content_parse_unordered_list_crlf(void **state)
"* zxc\r\n"
" 1234\r\n"
"\r\n"
- "fuuuu\r\n", NULL);
+ "fuuuu\r\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>lol</p>\r\n"
@@ -857,7 +907,7 @@ test_content_parse_unordered_list_crlf(void **state)
html = blogc_content_parse(
"* asd\r\n"
"* qwe\r\n"
- "* zxc", NULL);
+ "* zxc", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<ul>\r\n"
@@ -877,7 +927,7 @@ test_content_parse_ordered_list(void **state)
"\n"
"1. asd\n"
"2. qwe\n"
- "3. zxc", NULL);
+ "3. zxc", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>lol</p>\n"
@@ -892,7 +942,7 @@ test_content_parse_ordered_list(void **state)
"\n"
"1. asd\n"
"2. qwe\n"
- "3. zxc\n", NULL);
+ "3. zxc\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>lol</p>\n"
@@ -909,7 +959,7 @@ test_content_parse_ordered_list(void **state)
"2. qwe\n"
"3. zxc\n"
"\n"
- "fuuuu\n", NULL);
+ "fuuuu\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>lol</p>\n"
@@ -929,7 +979,7 @@ test_content_parse_ordered_list(void **state)
"3. zxc\n"
" 1234\n"
"\n"
- "fuuuu\n", NULL);
+ "fuuuu\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>lol</p>\n"
@@ -945,7 +995,7 @@ test_content_parse_ordered_list(void **state)
html = blogc_content_parse(
"1. asd\n"
"2. qwe\n"
- "3. zxc", NULL);
+ "3. zxc", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<ol>\n"
@@ -965,7 +1015,7 @@ test_content_parse_ordered_list_crlf(void **state)
"\r\n"
"1. asd\r\n"
"2. qwe\r\n"
- "3. zxc", NULL);
+ "3. zxc", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>lol</p>\r\n"
@@ -980,7 +1030,7 @@ test_content_parse_ordered_list_crlf(void **state)
"\r\n"
"1. asd\r\n"
"2. qwe\r\n"
- "3. zxc\r\n", NULL);
+ "3. zxc\r\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>lol</p>\r\n"
@@ -997,7 +1047,7 @@ test_content_parse_ordered_list_crlf(void **state)
"2. qwe\r\n"
"3. zxc\r\n"
"\r\n"
- "fuuuu\r\n", NULL);
+ "fuuuu\r\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>lol</p>\r\n"
@@ -1017,7 +1067,7 @@ test_content_parse_ordered_list_crlf(void **state)
"3. zxc\r\n"
" 1234\r\n"
"\r\n"
- "fuuuu\r\n", NULL);
+ "fuuuu\r\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>lol</p>\r\n"
@@ -1033,7 +1083,7 @@ test_content_parse_ordered_list_crlf(void **state)
html = blogc_content_parse(
"1. asd\r\n"
"2. qwe\r\n"
- "3. zxc", NULL);
+ "3. zxc", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<ol>\r\n"
@@ -1046,9 +1096,176 @@ test_content_parse_ordered_list_crlf(void **state)
static void
+test_content_parse_description(void **state)
+{
+ char *d = NULL;
+ char *html = blogc_content_parse(
+ "# foo\n"
+ "\n"
+ "bar", NULL, &d);
+ assert_non_null(html);
+ assert_string_equal(html,
+ "<h1 id=\"foo\">foo</h1>\n"
+ "<p>bar</p>\n");
+ assert_non_null(d);
+ assert_string_equal(d, "bar");
+ free(html);
+ free(d);
+ d = NULL;
+ html = blogc_content_parse(
+ "# foo\n"
+ "\n"
+ "bar\n", NULL, &d);
+ assert_non_null(html);
+ assert_string_equal(html,
+ "<h1 id=\"foo\">foo</h1>\n"
+ "<p>bar</p>\n");
+ assert_non_null(d);
+ assert_string_equal(d, "bar");
+ free(html);
+ free(d);
+ d = NULL;
+ html = blogc_content_parse(
+ "# foo\n"
+ "\n"
+ "qwe\n"
+ "bar\n", NULL, &d);
+ assert_non_null(html);
+ assert_string_equal(html,
+ "<h1 id=\"foo\">foo</h1>\n"
+ "<p>qwe\n"
+ "bar</p>\n");
+ assert_non_null(d);
+ assert_string_equal(d, "qwe");
+ free(html);
+ free(d);
+ d = NULL;
+ html = blogc_content_parse(
+ "# foo\n"
+ "\n"
+ "> qwe\n"
+ "\n"
+ "bar\n", NULL, &d);
+ assert_non_null(html);
+ assert_string_equal(html,
+ "<h1 id=\"foo\">foo</h1>\n"
+ "<blockquote><p>qwe</p>\n"
+ "</blockquote>\n"
+ "<p>bar</p>\n");
+ assert_non_null(d);
+ assert_string_equal(d, "qwe");
+ free(html);
+ free(d);
+ d = NULL;
+ html = blogc_content_parse(
+ "# foo\n"
+ "\n"
+ "> qwe\n"
+ "> zxc\n"
+ "\n"
+ "bar\n", NULL, &d);
+ assert_non_null(html);
+ assert_string_equal(html,
+ "<h1 id=\"foo\">foo</h1>\n"
+ "<blockquote><p>qwe\n"
+ "zxc</p>\n"
+ "</blockquote>\n"
+ "<p>bar</p>\n");
+ assert_non_null(d);
+ assert_string_equal(d, "qwe");
+ free(html);
+ free(d);
+}
+
+
+static void
+test_content_parse_description_crlf(void **state)
+{
+ char *d = NULL;
+ char *html = blogc_content_parse(
+ "# foo\r\n"
+ "\r\n"
+ "bar", NULL, &d);
+ assert_non_null(html);
+ assert_string_equal(html,
+ "<h1 id=\"foo\">foo</h1>\r\n"
+ "<p>bar</p>\r\n");
+ assert_non_null(d);
+ assert_string_equal(d, "bar");
+ free(html);
+ free(d);
+ d = NULL;
+ html = blogc_content_parse(
+ "# foo\r\n"
+ "\r\n"
+ "bar\r\n", NULL, &d);
+ assert_non_null(html);
+ assert_string_equal(html,
+ "<h1 id=\"foo\">foo</h1>\r\n"
+ "<p>bar</p>\r\n");
+ assert_non_null(d);
+ assert_string_equal(d, "bar");
+ free(html);
+ free(d);
+ d = NULL;
+ html = blogc_content_parse(
+ "# foo\r\n"
+ "\r\n"
+ "qwe\r\n"
+ "bar\r\n", NULL, &d);
+ assert_non_null(html);
+ assert_string_equal(html,
+ "<h1 id=\"foo\">foo</h1>\r\n"
+ "<p>qwe\r\n"
+ "bar</p>\r\n");
+ assert_non_null(d);
+ assert_string_equal(d, "qwe");
+ free(html);
+ free(d);
+ d = NULL;
+ html = blogc_content_parse(
+ "# foo\r\n"
+ "\r\n"
+ "> qwe\r\n"
+ "\r\n"
+ "bar\r\n", NULL, &d);
+ assert_non_null(html);
+ assert_string_equal(html,
+ "<h1 id=\"foo\">foo</h1>\r\n"
+ "<blockquote><p>qwe</p>\r\n"
+ "</blockquote>\r\n"
+ "<p>bar</p>\r\n");
+ assert_non_null(d);
+ assert_string_equal(d, "qwe");
+ free(html);
+ free(d);
+ d = NULL;
+ html = blogc_content_parse(
+ "# foo\r\n"
+ "\r\n"
+ "> qwe\r\n"
+ "> zxc\r\n"
+ "\r\n"
+ "bar\r\n", NULL, &d);
+ assert_non_null(html);
+ assert_string_equal(html,
+ "<h1 id=\"foo\">foo</h1>\r\n"
+ "<blockquote><p>qwe\r\n"
+ "zxc</p>\r\n"
+ "</blockquote>\r\n"
+ "<p>bar</p>\r\n");
+ assert_non_null(d);
+ assert_string_equal(d, "qwe");
+ free(html);
+ free(d);
+}
+
+
+static void
test_content_parse_invalid_excerpt(void **state)
{
size_t l = 0;
+ char *d = NULL;
char *html = blogc_content_parse(
"# test\n"
"\n"
@@ -1056,9 +1273,11 @@ test_content_parse_invalid_excerpt(void **state)
"..\n"
"\n"
"guda\n"
- "lol", &l);
+ "lol", &l, &d);
assert_non_null(html);
assert_int_equal(l, 0);
+ assert_non_null(d);
+ assert_string_equal(d, "chunda");
assert_string_equal(html,
"<h1 id=\"test\">test</h1>\n"
"<p>chunda\n"
@@ -1067,6 +1286,8 @@ test_content_parse_invalid_excerpt(void **state)
"lol</p>\n");
free(html);
l = 0;
+ free(d);
+ d = NULL;
html = blogc_content_parse(
"# test\n"
"\n"
@@ -1074,9 +1295,11 @@ test_content_parse_invalid_excerpt(void **state)
"\n"
"...\n"
"guda\n"
- "lol", &l);
+ "lol", &l, &d);
assert_non_null(html);
assert_int_equal(l, 0);
+ assert_non_null(d);
+ assert_string_equal(d, "chunda");
assert_string_equal(html,
"<h1 id=\"test\">test</h1>\n"
"<p>chunda</p>\n"
@@ -1085,15 +1308,19 @@ test_content_parse_invalid_excerpt(void **state)
"lol</p>\n");
free(html);
l = 0;
+ free(d);
+ d = NULL;
html = blogc_content_parse(
"# test\n"
"\n"
"chunda..\n"
"\n"
"guda\n"
- "lol", &l);
+ "lol", &l, &d);
assert_non_null(html);
assert_int_equal(l, 0);
+ assert_non_null(d);
+ assert_string_equal(d, "chunda..");
assert_string_equal(html,
"<h1 id=\"test\">test</h1>\n"
"<p>chunda..</p>\n"
@@ -1101,21 +1328,26 @@ test_content_parse_invalid_excerpt(void **state)
"lol</p>\n");
free(html);
l = 0;
+ free(d);
+ d = NULL;
html = blogc_content_parse(
"# test\n"
"\n"
"chunda\n"
"\n"
"...guda\n"
- "lol", &l);
+ "lol", &l, &d);
assert_non_null(html);
assert_int_equal(l, 0);
+ assert_non_null(d);
+ assert_string_equal(d, "chunda");
assert_string_equal(html,
"<h1 id=\"test\">test</h1>\n"
"<p>chunda</p>\n"
"<p>...guda\n"
"lol</p>\n");
free(html);
+ free(d);
}
@@ -1125,7 +1357,7 @@ test_content_parse_invalid_header(void **state)
char *html = blogc_content_parse(
"asd\n"
"\n"
- "##bola\n", NULL);
+ "##bola\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>asd</p>\n"
@@ -1142,7 +1374,7 @@ test_content_parse_invalid_header_empty(void **state)
"\n"
"##\n"
"\n"
- "qwe\n", NULL);
+ "qwe\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>asd</p>\n"
@@ -1159,7 +1391,7 @@ test_content_parse_invalid_blockquote(void **state)
char *html = blogc_content_parse(
"> asd\n"
"> bola\n"
- "> foo\n", NULL);
+ "> foo\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>&gt; asd\n"
@@ -1168,7 +1400,7 @@ test_content_parse_invalid_blockquote(void **state)
free(html);
html = blogc_content_parse(
"> asd\n"
- "> bola", NULL);
+ "> bola", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>&gt; asd\n"
@@ -1183,7 +1415,7 @@ test_content_parse_invalid_code(void **state)
char *html = blogc_content_parse(
" asd\n"
" bola\n"
- " foo\n", NULL);
+ " foo\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p> asd\n"
@@ -1193,7 +1425,7 @@ test_content_parse_invalid_code(void **state)
html = blogc_content_parse(
" asd\n"
" bola\n"
- " foo", NULL);
+ " foo", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p> asd\n"
@@ -1207,11 +1439,11 @@ static void
test_content_parse_invalid_horizontal_rule(void **state)
{
// this generates invalid html, but...
- char *html = blogc_content_parse("** asd", NULL);
+ char *html = blogc_content_parse("** asd", NULL, NULL);
assert_non_null(html);
assert_string_equal(html, "<p><strong> asd</p>\n");
free(html);
- html = blogc_content_parse("** asd\n", NULL);
+ html = blogc_content_parse("** asd\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html, "<p><strong> asd</p>\n");
free(html);
@@ -1224,7 +1456,7 @@ test_content_parse_invalid_unordered_list(void **state)
// more invalid html
char *html = blogc_content_parse(
"* asd\n"
- "1. qwe", NULL);
+ "1. qwe", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p><em> asd\n"
@@ -1233,7 +1465,7 @@ test_content_parse_invalid_unordered_list(void **state)
html = blogc_content_parse(
"* asd\n"
"1. qwe\n"
- "\n", NULL);
+ "\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p><em> asd\n"
@@ -1241,7 +1473,7 @@ test_content_parse_invalid_unordered_list(void **state)
free(html);
html = blogc_content_parse(
"* asd\n"
- "1. qwe\n", NULL);
+ "1. qwe\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p><em> asd\n"
@@ -1250,7 +1482,7 @@ test_content_parse_invalid_unordered_list(void **state)
free(html);
html = blogc_content_parse(
"* asd\n"
- "1. qwe\n", NULL);
+ "1. qwe\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p><em> asd\n"
@@ -1263,7 +1495,7 @@ test_content_parse_invalid_unordered_list(void **state)
"* asd\n"
"1. qwe\n"
"\n"
- "poi\n", NULL);
+ "poi\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>chunda</p>\n"
@@ -1280,7 +1512,7 @@ test_content_parse_invalid_ordered_list(void **state)
// more invalid html
char *html = blogc_content_parse(
"1. asd\n"
- "* qwe", NULL);
+ "* qwe", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>1. asd\n"
@@ -1289,7 +1521,7 @@ test_content_parse_invalid_ordered_list(void **state)
html = blogc_content_parse(
"1. asd\n"
"* qwe\n"
- "\n", NULL);
+ "\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>1. asd\n"
@@ -1297,7 +1529,7 @@ test_content_parse_invalid_ordered_list(void **state)
free(html);
html = blogc_content_parse(
"1. asd\n"
- "* qwe\n", NULL);
+ "* qwe\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>1. asd\n"
@@ -1306,7 +1538,7 @@ test_content_parse_invalid_ordered_list(void **state)
free(html);
html = blogc_content_parse(
"1. asd\n"
- "* qwe\n", NULL);
+ "* qwe\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>1. asd\n"
@@ -1319,7 +1551,7 @@ test_content_parse_invalid_ordered_list(void **state)
"1. asd\n"
"* qwe\n"
"\n"
- "poi\n", NULL);
+ "poi\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>chunda</p>\n"
@@ -1329,7 +1561,7 @@ test_content_parse_invalid_ordered_list(void **state)
free(html);
html = blogc_content_parse(
"1 asd\n"
- "* qwe\n", NULL);
+ "* qwe\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>1 asd\n"
@@ -1337,7 +1569,7 @@ test_content_parse_invalid_ordered_list(void **state)
free(html);
html = blogc_content_parse(
"a. asd\n"
- "2. qwe\n", NULL);
+ "2. qwe\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>a. asd\n"
@@ -1345,18 +1577,18 @@ test_content_parse_invalid_ordered_list(void **state)
free(html);
html = blogc_content_parse(
"1.\nasd\n"
- "2. qwe\n", NULL);
+ "2. qwe\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html,
"<p>1.\n"
"asd\n"
"2. qwe</p>\n");
free(html);
- html = blogc_content_parse("1.\n", NULL);
+ html = blogc_content_parse("1.\n", NULL, NULL);
assert_non_null(html);
assert_string_equal(html, "<p>1.</p>\n");
free(html);
- html = blogc_content_parse("1 ", NULL);
+ html = blogc_content_parse("1 ", NULL, NULL);
assert_non_null(html);
assert_string_equal(html, "<p>1 </p>\n");
free(html);
@@ -1806,6 +2038,8 @@ main(void)
unit_test(test_content_parse_unordered_list_crlf),
unit_test(test_content_parse_ordered_list),
unit_test(test_content_parse_ordered_list_crlf),
+ unit_test(test_content_parse_description),
+ unit_test(test_content_parse_description_crlf),
unit_test(test_content_parse_invalid_excerpt),
unit_test(test_content_parse_invalid_header),
unit_test(test_content_parse_invalid_header_empty),
diff --git a/tests/check_loader.c b/tests/check_loader.c
index 0db6194..c0e30df 100644
--- a/tests/check_loader.c
+++ b/tests/check_loader.c
@@ -113,12 +113,13 @@ test_source_parse_from_file(void **state)
sb_trie_t *t = blogc_source_parse_from_file("bola.txt", &err);
assert_null(err);
assert_non_null(t);
- assert_int_equal(sb_trie_size(t), 5);
+ assert_int_equal(sb_trie_size(t), 6);
assert_string_equal(sb_trie_lookup(t, "ASD"), "123");
assert_string_equal(sb_trie_lookup(t, "FILENAME"), "bola");
assert_string_equal(sb_trie_lookup(t, "EXCERPT"), "<p>bola</p>\n");
assert_string_equal(sb_trie_lookup(t, "CONTENT"), "<p>bola</p>\n");
assert_string_equal(sb_trie_lookup(t, "RAW_CONTENT"), "bola");
+ assert_string_equal(sb_trie_lookup(t, "DESCRIPTION"), "bola");
sb_trie_free(t);
}
diff --git a/tests/check_source_parser.c b/tests/check_source_parser.c
index fba997a..a2a3ddc 100644
--- a/tests/check_source_parser.c
+++ b/tests/check_source_parser.c
@@ -34,7 +34,7 @@ test_source_parse(void **state)
sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(err);
assert_non_null(source);
- assert_int_equal(sb_trie_size(source), 5);
+ assert_int_equal(sb_trie_size(source), 6);
assert_string_equal(sb_trie_lookup(source, "VAR1"), "asd asd");
assert_string_equal(sb_trie_lookup(source, "VAR2"), "123chunda");
assert_string_equal(sb_trie_lookup(source, "EXCERPT"),
@@ -47,6 +47,7 @@ test_source_parse(void **state)
"# This is a test\n"
"\n"
"bola\n");
+ assert_string_equal(sb_trie_lookup(source, "DESCRIPTION"), "bola");
sb_trie_free(source);
}
@@ -65,7 +66,7 @@ test_source_parse_crlf(void **state)
sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(err);
assert_non_null(source);
- assert_int_equal(sb_trie_size(source), 5);
+ assert_int_equal(sb_trie_size(source), 6);
assert_string_equal(sb_trie_lookup(source, "VAR1"), "asd asd");
assert_string_equal(sb_trie_lookup(source, "VAR2"), "123chunda");
assert_string_equal(sb_trie_lookup(source, "EXCERPT"),
@@ -78,6 +79,7 @@ test_source_parse_crlf(void **state)
"# This is a test\r\n"
"\r\n"
"bola\r\n");
+ assert_string_equal(sb_trie_lookup(source, "DESCRIPTION"), "bola");
sb_trie_free(source);
}
@@ -98,7 +100,7 @@ test_source_parse_with_spaces(void **state)
sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(err);
assert_non_null(source);
- assert_int_equal(sb_trie_size(source), 5);
+ assert_int_equal(sb_trie_size(source), 6);
assert_string_equal(sb_trie_lookup(source, "VAR1"), "chunda");
assert_string_equal(sb_trie_lookup(source, "BOLA"), "guda");
assert_string_equal(sb_trie_lookup(source, "EXCERPT"),
@@ -111,6 +113,7 @@ test_source_parse_with_spaces(void **state)
"# This is a test\n"
"\n"
"bola\n");
+ assert_string_equal(sb_trie_lookup(source, "DESCRIPTION"), "bola");
sb_trie_free(source);
}
@@ -134,7 +137,7 @@ test_source_parse_with_excerpt(void **state)
sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(err);
assert_non_null(source);
- assert_int_equal(sb_trie_size(source), 5);
+ assert_int_equal(sb_trie_size(source), 6);
assert_string_equal(sb_trie_lookup(source, "VAR1"), "asd asd");
assert_string_equal(sb_trie_lookup(source, "VAR2"), "123chunda");
assert_string_equal(sb_trie_lookup(source, "EXCERPT"),
@@ -154,6 +157,40 @@ test_source_parse_with_excerpt(void **state)
"\n"
"guda\n"
"yay");
+ assert_string_equal(sb_trie_lookup(source, "DESCRIPTION"), "bola");
+ sb_trie_free(source);
+}
+
+
+static void
+test_source_parse_with_description(void **state)
+{
+ const char *a =
+ "VAR1: asd asd\n"
+ "VAR2: 123chunda\n"
+ "DESCRIPTION: huehuehuebrbr\n"
+ "----------\n"
+ "# This is a test\n"
+ "\n"
+ "bola\n";
+ sb_error_t *err = NULL;
+ sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ assert_null(err);
+ assert_non_null(source);
+ assert_int_equal(sb_trie_size(source), 6);
+ assert_string_equal(sb_trie_lookup(source, "VAR1"), "asd asd");
+ assert_string_equal(sb_trie_lookup(source, "VAR2"), "123chunda");
+ assert_string_equal(sb_trie_lookup(source, "EXCERPT"),
+ "<h1 id=\"this-is-a-test\">This is a test</h1>\n"
+ "<p>bola</p>\n");
+ assert_string_equal(sb_trie_lookup(source, "CONTENT"),
+ "<h1 id=\"this-is-a-test\">This is a test</h1>\n"
+ "<p>bola</p>\n");
+ assert_string_equal(sb_trie_lookup(source, "RAW_CONTENT"),
+ "# This is a test\n"
+ "\n"
+ "bola\n");
+ assert_string_equal(sb_trie_lookup(source, "DESCRIPTION"), "huehuehuebrbr");
sb_trie_free(source);
}
@@ -484,6 +521,7 @@ main(void)
unit_test(test_source_parse_crlf),
unit_test(test_source_parse_with_spaces),
unit_test(test_source_parse_with_excerpt),
+ unit_test(test_source_parse_with_description),
unit_test(test_source_parse_config_empty),
unit_test(test_source_parse_config_invalid_key),
unit_test(test_source_parse_config_no_key),