diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-09-03 21:23:27 +0200 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-09-03 21:57:04 +0200 |
commit | e5f9cd349da231eae42ec9d35e3ebcd0d8fff973 (patch) | |
tree | ca81ecd0548cafdefffc4a61b3e1dd2afac32d16 /tests/blogc/check_template_parser.c | |
parent | a319fe44f6d50d25f546e17ad9907eedd9a358a0 (diff) | |
download | blogc-e5f9cd349da231eae42ec9d35e3ebcd0d8fff973.tar.gz blogc-e5f9cd349da231eae42ec9d35e3ebcd0d8fff973.tar.bz2 blogc-e5f9cd349da231eae42ec9d35e3ebcd0d8fff973.zip |
*: moved error handling to src/common/
Diffstat (limited to 'tests/blogc/check_template_parser.c')
-rw-r--r-- | tests/blogc/check_template_parser.c | 179 |
1 files changed, 90 insertions, 89 deletions
diff --git a/tests/blogc/check_template_parser.c b/tests/blogc/check_template_parser.c index b4c978f..c520e94 100644 --- a/tests/blogc/check_template_parser.c +++ b/tests/blogc/check_template_parser.c @@ -11,9 +11,10 @@ #include <setjmp.h> #include <cmocka.h> #include <string.h> -#include "../../src/blogc/template-parser.h" -#include "../../src/blogc/error.h" +#include "../../src/common/error.h" #include "../../src/common/utils.h" +#include "../../src/blogc/errors.h" +#include "../../src/blogc/template-parser.h" static void @@ -59,7 +60,7 @@ test_template_parse(void **state) "{% block listing_once %}asd{% endblock %}\n" "{%- foreach BOLA %}hahaha{% endforeach %}\n" "{% if BOLA == \"1\\\"0\" %}aee{% else %}fffuuuuuuu{% endif %}"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_null(err); assert_non_null(stmts); @@ -143,7 +144,7 @@ test_template_parse_crlf(void **state) "{% block listing_once %}asd{% endblock %}\r\n" "{%- foreach BOLA %}hahaha{% endforeach %}\r\n" "{% if BOLA == \"1\\\"0\" %}aee{% else %}fffuuuuuuu{% endif %}"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_null(err); assert_non_null(stmts); @@ -235,7 +236,7 @@ test_template_parse_html(void **state) " {% block listing_once %}</ul>{% endblock %}\n" " </body>\n" "</html>\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_null(err); assert_non_null(stmts); @@ -345,7 +346,7 @@ test_template_parse_ifdef_and_var_outside_block(void **state) "{% ifdef GUDA %}bola{% endif %}\n" "{{ BOLA }}\n" "{% ifndef CHUNDA %}{{ CHUNDA }}{% endif %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_null(err); assert_non_null(stmts); @@ -392,7 +393,7 @@ test_template_parse_nested_else(void **state) "bnm\n" "{% endif %}\n" "{% endif %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_null(err); assert_non_null(stmts); @@ -444,7 +445,7 @@ static void test_template_parse_invalid_block_start(void **state) { const char *a = "{% ASD %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -452,7 +453,7 @@ test_template_parse_invalid_block_start(void **state) assert_string_equal(err->msg, "Invalid statement syntax. Must begin with lowercase letter.\n" "Error occurred near line 1, position 4: {% ASD %}"); - blogc_error_free(err); + bc_error_free(err); a = "{%-- block entry %}\n"; err = NULL; stmts = blogc_template_parse(a, strlen(a), &err); @@ -462,7 +463,7 @@ test_template_parse_invalid_block_start(void **state) assert_string_equal(err->msg, "Invalid statement syntax. Duplicated whitespace cleaner before statement.\n" "Error occurred near line 1, position 4: {%-- block entry %}"); - blogc_error_free(err); + bc_error_free(err); a = "{% block entry --%}\n"; err = NULL; stmts = blogc_template_parse(a, strlen(a), &err); @@ -472,7 +473,7 @@ test_template_parse_invalid_block_start(void **state) assert_string_equal(err->msg, "Invalid statement syntax. Duplicated whitespace cleaner after statement.\n" "Error occurred near line 1, position 17: {% block entry --%}"); - blogc_error_free(err); + bc_error_free(err); } @@ -482,7 +483,7 @@ test_template_parse_invalid_block_nested(void **state) const char *a = "{% block entry %}\n" "{% block listing %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -490,7 +491,7 @@ test_template_parse_invalid_block_nested(void **state) assert_string_equal(err->msg, "Blocks can't be nested.\n" "Error occurred near line 2, position 9: {% block listing %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -500,7 +501,7 @@ test_template_parse_invalid_foreach_nested(void **state) const char *a = "{% foreach A %}\n" "{% foreach B %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -508,7 +509,7 @@ test_template_parse_invalid_foreach_nested(void **state) assert_string_equal(err->msg, "'foreach' statements can't be nested.\n" "Error occurred near line 2, position 11: {% foreach B %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -516,7 +517,7 @@ static void test_template_parse_invalid_block_not_open(void **state) { const char *a = "{% endblock %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -524,7 +525,7 @@ test_template_parse_invalid_block_not_open(void **state) assert_string_equal(err->msg, "'endblock' statement without an open 'block' statement.\n" "Error occurred near line 1, position 12: {% endblock %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -532,7 +533,7 @@ static void test_template_parse_invalid_endif_not_open(void **state) { const char *a = "{% block listing %}{% endif %}{% endblock %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -541,7 +542,7 @@ test_template_parse_invalid_endif_not_open(void **state) "'endif' statement without an open 'if', 'ifdef' or 'ifndef' statement.\n" "Error occurred near line 1, position 28: " "{% block listing %}{% endif %}{% endblock %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -549,7 +550,7 @@ static void test_template_parse_invalid_endif_not_open_inside_block(void **state) { const char *a = "{% ifdef BOLA %}{% block listing %}{% endif %}{% endblock %}"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -558,7 +559,7 @@ test_template_parse_invalid_endif_not_open_inside_block(void **state) "'endif' statement without an open 'if', 'ifdef' or 'ifndef' statement.\n" "Error occurred near line 1, position 44: {% ifdef BOLA %}{% block " "listing %}{% endif %}{% endblock %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -566,7 +567,7 @@ static void test_template_parse_invalid_else_not_open_inside_block(void **state) { const char *a = "{% ifdef BOLA %}{% block listing %}{% else %}{% endif %}{% endblock %}"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -575,7 +576,7 @@ test_template_parse_invalid_else_not_open_inside_block(void **state) "'else' statement without an open 'if', 'ifdef' or 'ifndef' statement.\n" "Error occurred near line 1, position 43: {% ifdef BOLA %}" "{% block listing %}{% else %}{% endif %}{% endblock %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -583,7 +584,7 @@ static void test_template_parse_invalid_endforeach_not_open(void **state) { const char *a = "{% endforeach %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -591,7 +592,7 @@ test_template_parse_invalid_endforeach_not_open(void **state) assert_string_equal(err->msg, "'endforeach' statement without an open 'foreach' statement.\n" "Error occurred near line 1, position 14: {% endforeach %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -600,7 +601,7 @@ test_template_parse_invalid_endforeach_not_open_inside_block(void **state) { const char *a = "{% foreach TAGS %}{% block entry %}{% endforeach %}" "{% endblock %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -609,7 +610,7 @@ test_template_parse_invalid_endforeach_not_open_inside_block(void **state) "'endforeach' statement without an open 'foreach' statement.\n" "Error occurred near line 1, position 49: {% foreach TAGS %}" "{% block entry %}{% endforeach %}{% endblock %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -618,7 +619,7 @@ test_template_parse_invalid_endforeach_not_open_inside_block2(void **state) { const char *a = "{% block entry %}{% foreach TAGS %}" "{% endforeach %}{% endforeach %}{% endblock %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -627,7 +628,7 @@ test_template_parse_invalid_endforeach_not_open_inside_block2(void **state) "'endforeach' statement without an open 'foreach' statement.\n" "Error occurred near line 1, position 65: {% block entry %}" "{% foreach TAGS %}{% endforeach %}{% endforeach %}{% endblock %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -636,14 +637,14 @@ test_template_parse_invalid_endforeach_not_closed_inside_block(void **state) { const char *a = "{% block entry %}{% foreach TAGS %}{% endblock %}" "{% endforeach %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER); assert_string_equal(err->msg, "An open 'foreach' statement was not closed inside a 'entry' block!"); - blogc_error_free(err); + bc_error_free(err); } @@ -652,14 +653,14 @@ test_template_parse_invalid_endforeach_not_closed_inside_block2(void **state) { const char *a = "{% block entry %}{% foreach TAGS %}{% endforeach %}" "{% foreach TAGS %}{% endblock %}{% endforeach %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER); assert_string_equal(err->msg, "An open 'foreach' statement was not closed inside a 'entry' block!"); - blogc_error_free(err); + bc_error_free(err); } @@ -667,7 +668,7 @@ static void test_template_parse_invalid_block_name(void **state) { const char *a = "{% chunda %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -676,7 +677,7 @@ test_template_parse_invalid_block_name(void **state) "Invalid statement type: Allowed types are: 'block', 'endblock', 'if', " "'ifdef', 'ifndef', 'else', 'endif', 'foreach' and 'endforeach'.\n" "Error occurred near line 1, position 10: {% chunda %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -684,7 +685,7 @@ static void test_template_parse_invalid_block_type_start(void **state) { const char *a = "{% block ENTRY %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -692,7 +693,7 @@ test_template_parse_invalid_block_type_start(void **state) assert_string_equal(err->msg, "Invalid block syntax. Must begin with lowercase letter.\n" "Error occurred near line 1, position 10: {% block ENTRY %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -700,7 +701,7 @@ static void test_template_parse_invalid_block_type(void **state) { const char *a = "{% block chunda %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -708,7 +709,7 @@ test_template_parse_invalid_block_type(void **state) assert_string_equal(err->msg, "Invalid block type. Allowed types are: 'entry', 'listing' and 'listing_once'.\n" "Error occurred near line 1, position 16: {% block chunda %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -716,7 +717,7 @@ static void test_template_parse_invalid_ifdef_start(void **state) { const char *a = "{% block entry %}{% ifdef guda %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -725,7 +726,7 @@ test_template_parse_invalid_ifdef_start(void **state) "Invalid variable name. Must begin with uppercase letter.\n" "Error occurred near line 1, position 27: " "{% block entry %}{% ifdef guda %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -733,7 +734,7 @@ static void test_template_parse_invalid_foreach_start(void **state) { const char *a = "{% block entry %}{% foreach guda %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -742,7 +743,7 @@ test_template_parse_invalid_foreach_start(void **state) "Invalid foreach variable name. Must begin with uppercase letter.\n" "Error occurred near line 1, position 29: " "{% block entry %}{% foreach guda %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -750,7 +751,7 @@ static void test_template_parse_invalid_ifdef_variable(void **state) { const char *a = "{% block entry %}{% ifdef BoLA %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -759,7 +760,7 @@ test_template_parse_invalid_ifdef_variable(void **state) "Invalid variable name. Must be uppercase letter, number or '_'.\n" "Error occurred near line 1, position 28: " "{% block entry %}{% ifdef BoLA %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -767,7 +768,7 @@ static void test_template_parse_invalid_ifdef_variable2(void **state) { const char *a = "{% block entry %}{% ifdef 0123 %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -776,7 +777,7 @@ test_template_parse_invalid_ifdef_variable2(void **state) "Invalid variable name. Must begin with uppercase letter.\n" "Error occurred near line 1, position 27: " "{% block entry %}{% ifdef 0123 %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -784,7 +785,7 @@ static void test_template_parse_invalid_foreach_variable(void **state) { const char *a = "{% block entry %}{% foreach BoLA %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -793,7 +794,7 @@ test_template_parse_invalid_foreach_variable(void **state) "Invalid foreach variable name. Must be uppercase letter, number or '_'.\n" "Error occurred near line 1, position 30: " "{% block entry %}{% foreach BoLA %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -801,7 +802,7 @@ static void test_template_parse_invalid_foreach_variable2(void **state) { const char *a = "{% block entry %}{% foreach 0123 %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -810,7 +811,7 @@ test_template_parse_invalid_foreach_variable2(void **state) "Invalid foreach variable name. Must begin with uppercase letter.\n" "Error occurred near line 1, position 29: {% block entry %}" "{% foreach 0123 %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -818,7 +819,7 @@ static void test_template_parse_invalid_if_operator(void **state) { const char *a = "{% block entry %}{% if BOLA = \"asd\" %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -827,7 +828,7 @@ test_template_parse_invalid_if_operator(void **state) "Invalid 'if' operator. Must be '<', '>', '<=', '>=', '==' or '!='.\n" "Error occurred near line 1, position 29: " "{% block entry %}{% if BOLA = \"asd\" %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -835,7 +836,7 @@ static void test_template_parse_invalid_if_operand(void **state) { const char *a = "{% block entry %}{% if BOLA == asd %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -844,7 +845,7 @@ test_template_parse_invalid_if_operand(void **state) "Invalid 'if' operand. Must be double-quoted static string or variable.\n" "Error occurred near line 1, position 32: " "{% block entry %}{% if BOLA == asd %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -852,7 +853,7 @@ static void test_template_parse_invalid_if_operand2(void **state) { const char *a = "{% block entry %}{% if BOLA == \"asd %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -861,7 +862,7 @@ test_template_parse_invalid_if_operand2(void **state) "Found an open double-quoted string.\n" "Error occurred near line 1, position 32: " "{% block entry %}{% if BOLA == \"asd %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -869,7 +870,7 @@ static void test_template_parse_invalid_if_operand3(void **state) { const char *a = "{% block entry %}{% if BOLA == 0123 %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -878,7 +879,7 @@ test_template_parse_invalid_if_operand3(void **state) "Invalid 'if' operand. Must be double-quoted static string or variable.\n" "Error occurred near line 1, position 32: " "{% block entry %}{% if BOLA == 0123 %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -886,7 +887,7 @@ static void test_template_parse_invalid_else1(void **state) { const char *a = "{% else %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -894,7 +895,7 @@ test_template_parse_invalid_else1(void **state) assert_string_equal(err->msg, "'else' statement without an open 'if', 'ifdef' or 'ifndef' statement.\n" "Error occurred near line 1, position 8: {% else %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -902,7 +903,7 @@ static void test_template_parse_invalid_else2(void **state) { const char *a = "{% if BOLA == \"123\" %}{% if GUDA == \"1\" %}{% else %}{% else %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -911,7 +912,7 @@ test_template_parse_invalid_else2(void **state) "More than one 'else' statement for an open 'if', 'ifdef' or 'ifndef' " "statement.\nError occurred near line 1, position 60: {% if BOLA == \"123\" " "%}{% if GUDA == \"1\" %}{% else %}{% else %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -926,7 +927,7 @@ test_template_parse_invalid_else3(void **state) "{% endif %}\n" "{% else %}\n" "{% else %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -934,7 +935,7 @@ test_template_parse_invalid_else3(void **state) assert_string_equal(err->msg, "More than one 'else' statement for an open 'if', 'ifdef' or 'ifndef' " "statement.\nError occurred near line 7, position 8: {% else %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -942,7 +943,7 @@ static void test_template_parse_invalid_block_end(void **state) { const char *a = "{% block entry }}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -950,7 +951,7 @@ test_template_parse_invalid_block_end(void **state) assert_string_equal(err->msg, "Invalid statement syntax. Must end with '%}'.\n" "Error occurred near line 1, position 16: {% block entry }}"); - blogc_error_free(err); + bc_error_free(err); } @@ -958,7 +959,7 @@ static void test_template_parse_invalid_variable_name(void **state) { const char *a = "{% block entry %}{{ bola }}{% endblock %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -967,7 +968,7 @@ test_template_parse_invalid_variable_name(void **state) "Invalid variable name. Must begin with uppercase letter.\n" "Error occurred near line 1, position 21: " "{% block entry %}{{ bola }}{% endblock %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -975,7 +976,7 @@ static void test_template_parse_invalid_variable_name2(void **state) { const char *a = "{% block entry %}{{ Bola }}{% endblock %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -984,7 +985,7 @@ test_template_parse_invalid_variable_name2(void **state) "Invalid variable name. Must be uppercase letter, number or '_'.\n" "Error occurred near line 1, position 22: " "{% block entry %}{{ Bola }}{% endblock %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -992,7 +993,7 @@ static void test_template_parse_invalid_variable_name3(void **state) { const char *a = "{% block entry %}{{ 0123 }}{% endblock %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -1001,7 +1002,7 @@ test_template_parse_invalid_variable_name3(void **state) "Invalid variable name. Must begin with uppercase letter.\n" "Error occurred near line 1, position 21: {% block entry %}{{ 0123 }}" "{% endblock %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -1009,7 +1010,7 @@ static void test_template_parse_invalid_variable_end(void **state) { const char *a = "{% block entry %}{{ BOLA %}{% endblock %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -1018,7 +1019,7 @@ test_template_parse_invalid_variable_end(void **state) "Invalid statement syntax. Must end with '}}'.\n" "Error occurred near line 1, position 26: " "{% block entry %}{{ BOLA %}{% endblock %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -1026,7 +1027,7 @@ static void test_template_parse_invalid_close(void **state) { const char *a = "{% block entry %%\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -1034,7 +1035,7 @@ test_template_parse_invalid_close(void **state) assert_string_equal(err->msg, "Invalid statement syntax. Must end with '}'.\n" "Error occurred near line 1, position 17: {% block entry %%"); - blogc_error_free(err); + bc_error_free(err); } @@ -1042,7 +1043,7 @@ static void test_template_parse_invalid_close2(void **state) { const char *a = "{% block entry %}{{ BOLA }%{% endblock %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -1051,7 +1052,7 @@ test_template_parse_invalid_close2(void **state) "Invalid statement syntax. Must end with '}'.\n" "Error occurred near line 1, position 27: " "{% block entry %}{{ BOLA }%{% endblock %}"); - blogc_error_free(err); + bc_error_free(err); } @@ -1059,14 +1060,14 @@ static void test_template_parse_invalid_endif_not_closed(void **state) { const char *a = "{% block entry %}{% endblock %}{% ifdef BOLA %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER); assert_string_equal(err->msg, "1 open 'if', 'ifdef' and/or 'ifndef' statements " "were not closed!"); - blogc_error_free(err); + bc_error_free(err); } @@ -1074,7 +1075,7 @@ static void test_template_parse_invalid_endif_not_closed_inside_block(void **state) { const char *a = "{% block listing %}{% ifdef BOLA %}{% endblock %}{% endif %}"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -1082,7 +1083,7 @@ test_template_parse_invalid_endif_not_closed_inside_block(void **state) assert_string_equal(err->msg, "1 open 'if', 'ifdef' and/or 'ifndef' statements were not closed inside " "a 'listing' block!"); - blogc_error_free(err); + bc_error_free(err); } @@ -1090,7 +1091,7 @@ static void test_template_parse_invalid_else_not_closed_inside_block(void **state) { const char *a = "{% block listing %}{% ifdef BOLA %}{% else %}{% endblock %}{% endif %}"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); @@ -1098,7 +1099,7 @@ test_template_parse_invalid_else_not_closed_inside_block(void **state) assert_string_equal(err->msg, "1 open 'if', 'ifdef' and/or 'ifndef' statements were not closed inside " "a 'listing' block!"); - blogc_error_free(err); + bc_error_free(err); } @@ -1106,13 +1107,13 @@ static void test_template_parse_invalid_block_not_closed(void **state) { const char *a = "{% block entry %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER); assert_string_equal(err->msg, "An open block was not closed!"); - blogc_error_free(err); + bc_error_free(err); } @@ -1120,13 +1121,13 @@ static void test_template_parse_invalid_foreach_not_closed(void **state) { const char *a = "{% foreach ASD %}\n"; - blogc_error_t *err = NULL; + bc_error_t *err = NULL; bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); assert_non_null(err); assert_null(stmts); assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER); assert_string_equal(err->msg, "An open 'foreach' statement was not closed!"); - blogc_error_free(err); + bc_error_free(err); } |