diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2015-04-18 17:17:37 -0300 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2015-04-18 17:17:37 -0300 |
commit | de39a41da62c4b3820b4805ddb7c4970c36bc257 (patch) | |
tree | 33da0f360932be9c76dd79a05a9bceaaed5a0441 /tests | |
parent | d3e1e90f0979621f741357484e5a8f9656ee4a22 (diff) | |
download | blogc-de39a41da62c4b3820b4805ddb7c4970c36bc257.tar.gz blogc-de39a41da62c4b3820b4805ddb7c4970c36bc257.tar.bz2 blogc-de39a41da62c4b3820b4805ddb7c4970c36bc257.zip |
added loader, error handling and cli. tests needed
Diffstat (limited to 'tests')
-rw-r--r-- | tests/check_source_parser.c | 9 | ||||
-rw-r--r-- | tests/check_template_parser.c | 9 |
2 files changed, 14 insertions, 4 deletions
diff --git a/tests/check_source_parser.c b/tests/check_source_parser.c index 2f5880a..c58479e 100644 --- a/tests/check_source_parser.c +++ b/tests/check_source_parser.c @@ -16,6 +16,7 @@ #include <cmocka.h> #include <string.h> #include "../src/source-parser.h" +#include "../src/error.h" static void @@ -28,7 +29,9 @@ test_source_parse(void **state) "# This is a test\n" "\n" "bola\n"; - blogc_source_t *source = blogc_source_parse(a, strlen(a)); + blogc_error_t *err = NULL; + blogc_source_t *source = blogc_source_parse(a, strlen(a), &err); + assert_null(err); assert_non_null(source); assert_int_equal(b_trie_size(source->config), 2); assert_string_equal(b_trie_lookup(source->config, "VAR1"), "asd asd"); @@ -53,7 +56,9 @@ test_source_parse_with_spaces(void **state) "# This is a test\n" "\n" "bola\n"; - blogc_source_t *source = blogc_source_parse(a, strlen(a)); + blogc_error_t *err = NULL; + blogc_source_t *source = blogc_source_parse(a, strlen(a), &err); + assert_null(err); assert_non_null(source); assert_int_equal(b_trie_size(source->config), 2); assert_string_equal(b_trie_lookup(source->config, "VAR1"), "chunda"); diff --git a/tests/check_template_parser.c b/tests/check_template_parser.c index 7839bbf..a0cd95c 100644 --- a/tests/check_template_parser.c +++ b/tests/check_template_parser.c @@ -16,6 +16,7 @@ #include <cmocka.h> #include <string.h> #include "../src/template-parser.h" +#include "../src/error.h" static void @@ -44,7 +45,9 @@ test_template_parse(void **state) "{% endblock %}\n" "{% block multiple_sources %}{{ BOLA }}{% endblock %}\n" "{% block multiple_sources_once %}asd{% endblock %}\n"; - b_slist_t *stmts = blogc_template_parse(a, strlen(a)); + blogc_error_t *err = NULL; + b_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); + assert_null(err); assert_non_null(stmts); blogc_assert_template_stmt(stmts, "Test\n\n ", BLOGC_TEMPLATE_CONTENT_STMT); @@ -110,7 +113,9 @@ test_template_parse_html(void **state) " {% block multiple_sources_once %}</ul>{% endblock %}\n" " </body>\n" "</html>\n"; - b_slist_t *stmts = blogc_template_parse(a, strlen(a)); + blogc_error_t *err = NULL; + b_slist_t *stmts = blogc_template_parse(a, strlen(a), &err); + assert_null(err); assert_non_null(stmts); blogc_assert_template_stmt(stmts, "<html>\n <head>\n ", BLOGC_TEMPLATE_CONTENT_STMT); |