diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2020-05-16 03:33:22 +0200 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2020-05-16 03:33:22 +0200 |
commit | 8e12ae57ebe87d25c2c34ec304047fec3013da85 (patch) | |
tree | fc7f974219f6d60d8e866a540da45f69e696546b /tests/blogc/check_template_parser.c | |
parent | f5db671822b7b6dc74166c1c9e34a900c7f0d0cb (diff) | |
download | blogc-8e12ae57ebe87d25c2c34ec304047fec3013da85.tar.gz blogc-8e12ae57ebe87d25c2c34ec304047fec3013da85.tar.bz2 blogc-8e12ae57ebe87d25c2c34ec304047fec3013da85.zip |
blogc: added listing_empty template block
Diffstat (limited to 'tests/blogc/check_template_parser.c')
-rw-r--r-- | tests/blogc/check_template_parser.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/tests/blogc/check_template_parser.c b/tests/blogc/check_template_parser.c index 15ef7c4..79d41fb 100644 --- a/tests/blogc/check_template_parser.c +++ b/tests/blogc/check_template_parser.c @@ -59,7 +59,8 @@ test_template_parse(void **state) "{% block listing_once %}asd{% endblock %}\n" "{%- foreach BOLA %}hahaha{% endforeach %}\n" "{% if BOLA == \"1\\\"0\" %}aee{% else %}fffuuuuuuu{% endif %}\n" - "{% block listing_entry %}lol{% endblock %}"; + "{% block listing_entry %}lol{% endblock %}\n" + "{% block listing_empty %}empty{% endblock %}"; bc_error_t *err = NULL; bc_slist_t *ast = blogc_template_parse(a, strlen(a), &err); assert_null(err); @@ -125,8 +126,17 @@ test_template_parse(void **state) blogc_assert_template_node(tmp, "\n", BLOGC_TEMPLATE_NODE_CONTENT); blogc_assert_template_node(tmp->next, "listing_entry", BLOGC_TEMPLATE_NODE_BLOCK); blogc_assert_template_node(tmp->next->next, "lol", BLOGC_TEMPLATE_NODE_CONTENT); - blogc_assert_template_node(tmp->next->next->next, NULL, BLOGC_TEMPLATE_NODE_ENDBLOCK); - assert_null(tmp->next->next->next->next); + blogc_assert_template_node(tmp->next->next->next, NULL, + BLOGC_TEMPLATE_NODE_ENDBLOCK); + blogc_assert_template_node(tmp->next->next->next->next, "\n", + BLOGC_TEMPLATE_NODE_CONTENT); + blogc_assert_template_node(tmp->next->next->next->next->next, "listing_empty", + BLOGC_TEMPLATE_NODE_BLOCK); + blogc_assert_template_node(tmp->next->next->next->next->next->next, "empty", + BLOGC_TEMPLATE_NODE_CONTENT); + blogc_assert_template_node(tmp->next->next->next->next->next->next->next, NULL, + BLOGC_TEMPLATE_NODE_ENDBLOCK); + assert_null(tmp->next->next->next->next->next->next->next->next); blogc_template_free_ast(ast); } @@ -841,8 +851,8 @@ test_template_parse_invalid_block_type(void **state) assert_null(ast); assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER); assert_string_equal(err->msg, - "Invalid block type. Allowed types are: 'entry', 'listing', 'listing_once' " - "and 'listing_entry'.\n" + "Invalid block type. Allowed types are: 'entry', 'listing', 'listing_once', " + "'listing_empty' and 'listing_entry'.\n" "Error occurred near line 1, position 16: {% block chunda %}"); bc_error_free(err); } |