aboutsummaryrefslogtreecommitdiffstats
path: root/tests/blogc/check_source_parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/blogc/check_source_parser.c')
-rw-r--r--tests/blogc/check_source_parser.c325
1 files changed, 163 insertions, 162 deletions
diff --git a/tests/blogc/check_source_parser.c b/tests/blogc/check_source_parser.c
index d40633f..142e957 100644
--- a/tests/blogc/check_source_parser.c
+++ b/tests/blogc/check_source_parser.c
@@ -11,8 +11,9 @@
#include <setjmp.h>
#include <cmocka.h>
#include <string.h>
-#include "../../src/common/error.h"
-#include "../../src/common/utils.h"
+#include <squareball.h>
+
+#include "../../src/blogc/error.h"
#include "../../src/blogc/source-parser.h"
@@ -26,26 +27,26 @@ test_source_parse(void **state)
"# This is a test\n"
"\n"
"bola\n";
- bc_error_t *err = NULL;
- bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ 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(bc_trie_size(source), 7);
- assert_string_equal(bc_trie_lookup(source, "VAR1"), "asd asd");
- assert_string_equal(bc_trie_lookup(source, "VAR2"), "123chunda");
- assert_string_equal(bc_trie_lookup(source, "EXCERPT"),
+ assert_int_equal(sb_trie_size(source), 7);
+ 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(bc_trie_lookup(source, "CONTENT"),
+ 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(bc_trie_lookup(source, "RAW_CONTENT"),
+ assert_string_equal(sb_trie_lookup(source, "RAW_CONTENT"),
"# This is a test\n"
"\n"
"bola\n");
- assert_string_equal(bc_trie_lookup(source, "FIRST_HEADER"), "This is a test");
- assert_string_equal(bc_trie_lookup(source, "DESCRIPTION"), "bola");
- bc_trie_free(source);
+ assert_string_equal(sb_trie_lookup(source, "FIRST_HEADER"), "This is a test");
+ assert_string_equal(sb_trie_lookup(source, "DESCRIPTION"), "bola");
+ sb_trie_free(source);
}
@@ -59,26 +60,26 @@ test_source_parse_crlf(void **state)
"# This is a test\r\n"
"\r\n"
"bola\r\n";
- bc_error_t *err = NULL;
- bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ 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(bc_trie_size(source), 7);
- assert_string_equal(bc_trie_lookup(source, "VAR1"), "asd asd");
- assert_string_equal(bc_trie_lookup(source, "VAR2"), "123chunda");
- assert_string_equal(bc_trie_lookup(source, "EXCERPT"),
+ assert_int_equal(sb_trie_size(source), 7);
+ 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>\r\n"
"<p>bola</p>\r\n");
- assert_string_equal(bc_trie_lookup(source, "CONTENT"),
+ assert_string_equal(sb_trie_lookup(source, "CONTENT"),
"<h1 id=\"this-is-a-test\">This is a test</h1>\r\n"
"<p>bola</p>\r\n");
- assert_string_equal(bc_trie_lookup(source, "RAW_CONTENT"),
+ assert_string_equal(sb_trie_lookup(source, "RAW_CONTENT"),
"# This is a test\r\n"
"\r\n"
"bola\r\n");
- assert_string_equal(bc_trie_lookup(source, "FIRST_HEADER"), "This is a test");
- assert_string_equal(bc_trie_lookup(source, "DESCRIPTION"), "bola");
- bc_trie_free(source);
+ assert_string_equal(sb_trie_lookup(source, "FIRST_HEADER"), "This is a test");
+ assert_string_equal(sb_trie_lookup(source, "DESCRIPTION"), "bola");
+ sb_trie_free(source);
}
@@ -94,26 +95,26 @@ test_source_parse_with_spaces(void **state)
"# This is a test\n"
"\n"
"bola\n";
- bc_error_t *err = NULL;
- bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ 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(bc_trie_size(source), 7);
- assert_string_equal(bc_trie_lookup(source, "VAR1"), "chunda");
- assert_string_equal(bc_trie_lookup(source, "BOLA"), "guda");
- assert_string_equal(bc_trie_lookup(source, "EXCERPT"),
+ assert_int_equal(sb_trie_size(source), 7);
+ 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"),
"<h1 id=\"this-is-a-test\">This is a test</h1>\n"
"<p>bola</p>\n");
- assert_string_equal(bc_trie_lookup(source, "CONTENT"),
+ 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(bc_trie_lookup(source, "RAW_CONTENT"),
+ assert_string_equal(sb_trie_lookup(source, "RAW_CONTENT"),
"# This is a test\n"
"\n"
"bola\n");
- assert_string_equal(bc_trie_lookup(source, "FIRST_HEADER"), "This is a test");
- assert_string_equal(bc_trie_lookup(source, "DESCRIPTION"), "bola");
- bc_trie_free(source);
+ assert_string_equal(sb_trie_lookup(source, "FIRST_HEADER"), "This is a test");
+ assert_string_equal(sb_trie_lookup(source, "DESCRIPTION"), "bola");
+ sb_trie_free(source);
}
@@ -132,22 +133,22 @@ test_source_parse_with_excerpt(void **state)
"\n"
"guda\n"
"yay";
- bc_error_t *err = NULL;
- bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ 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(bc_trie_size(source), 7);
- assert_string_equal(bc_trie_lookup(source, "VAR1"), "asd asd");
- assert_string_equal(bc_trie_lookup(source, "VAR2"), "123chunda");
- assert_string_equal(bc_trie_lookup(source, "EXCERPT"),
+ assert_int_equal(sb_trie_size(source), 7);
+ 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(bc_trie_lookup(source, "CONTENT"),
+ assert_string_equal(sb_trie_lookup(source, "CONTENT"),
"<h1 id=\"this-is-a-test\">This is a test</h1>\n"
"<p>bola</p>\n"
"<p>guda\n"
"yay</p>\n");
- assert_string_equal(bc_trie_lookup(source, "RAW_CONTENT"),
+ assert_string_equal(sb_trie_lookup(source, "RAW_CONTENT"),
"# This is a test\n"
"\n"
"bola\n"
@@ -156,9 +157,9 @@ test_source_parse_with_excerpt(void **state)
"\n"
"guda\n"
"yay");
- assert_string_equal(bc_trie_lookup(source, "FIRST_HEADER"), "This is a test");
- assert_string_equal(bc_trie_lookup(source, "DESCRIPTION"), "bola");
- bc_trie_free(source);
+ assert_string_equal(sb_trie_lookup(source, "FIRST_HEADER"), "This is a test");
+ assert_string_equal(sb_trie_lookup(source, "DESCRIPTION"), "bola");
+ sb_trie_free(source);
}
@@ -173,26 +174,26 @@ test_source_parse_with_first_header(void **state)
"# This is a test\n"
"\n"
"bola\n";
- bc_error_t *err = NULL;
- bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ 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(bc_trie_size(source), 7);
- assert_string_equal(bc_trie_lookup(source, "VAR1"), "asd asd");
- assert_string_equal(bc_trie_lookup(source, "VAR2"), "123chunda");
- assert_string_equal(bc_trie_lookup(source, "EXCERPT"),
+ assert_int_equal(sb_trie_size(source), 7);
+ 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(bc_trie_lookup(source, "CONTENT"),
+ 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(bc_trie_lookup(source, "RAW_CONTENT"),
+ assert_string_equal(sb_trie_lookup(source, "RAW_CONTENT"),
"# This is a test\n"
"\n"
"bola\n");
- assert_string_equal(bc_trie_lookup(source, "FIRST_HEADER"), "THIS IS CHUNDA!");
- assert_string_equal(bc_trie_lookup(source, "DESCRIPTION"), "bola");
- bc_trie_free(source);
+ assert_string_equal(sb_trie_lookup(source, "FIRST_HEADER"), "THIS IS CHUNDA!");
+ assert_string_equal(sb_trie_lookup(source, "DESCRIPTION"), "bola");
+ sb_trie_free(source);
}
@@ -207,26 +208,26 @@ test_source_parse_with_description(void **state)
"# This is a test\n"
"\n"
"bola\n";
- bc_error_t *err = NULL;
- bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ 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(bc_trie_size(source), 7);
- assert_string_equal(bc_trie_lookup(source, "VAR1"), "asd asd");
- assert_string_equal(bc_trie_lookup(source, "VAR2"), "123chunda");
- assert_string_equal(bc_trie_lookup(source, "EXCERPT"),
+ assert_int_equal(sb_trie_size(source), 7);
+ 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(bc_trie_lookup(source, "CONTENT"),
+ 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(bc_trie_lookup(source, "RAW_CONTENT"),
+ assert_string_equal(sb_trie_lookup(source, "RAW_CONTENT"),
"# This is a test\n"
"\n"
"bola\n");
- assert_string_equal(bc_trie_lookup(source, "FIRST_HEADER"), "This is a test");
- assert_string_equal(bc_trie_lookup(source, "DESCRIPTION"), "huehuehuebrbr");
- bc_trie_free(source);
+ assert_string_equal(sb_trie_lookup(source, "FIRST_HEADER"), "This is a test");
+ assert_string_equal(sb_trie_lookup(source, "DESCRIPTION"), "huehuehuebrbr");
+ sb_trie_free(source);
}
@@ -234,14 +235,14 @@ static void
test_source_parse_config_empty(void **state)
{
const char *a = "";
- bc_error_t *err = NULL;
- bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ sb_error_t *err = NULL;
+ sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
- assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->code, BLOGC_ERROR_SOURCE_PARSER);
assert_string_equal(err->msg, "Your source file is empty.");
- bc_error_free(err);
- bc_trie_free(source);
+ sb_error_free(err);
+ sb_trie_free(source);
}
@@ -249,15 +250,15 @@ static void
test_source_parse_config_invalid_key(void **state)
{
const char *a = "bola: guda";
- bc_error_t *err = NULL;
- bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ sb_error_t *err = NULL;
+ sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_non_null(err);
- assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->code, BLOGC_ERROR_SOURCE_PARSER);
assert_string_equal(err->msg,
"Can't find a configuration key or the content separator.\n"
"Error occurred near line 1, position 1: bola: guda");
- bc_error_free(err);
- bc_trie_free(source);
+ sb_error_free(err);
+ sb_trie_free(source);
}
@@ -265,15 +266,15 @@ static void
test_source_parse_config_no_key(void **state)
{
const char *a = "BOLa";
- bc_error_t *err = NULL;
- bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ sb_error_t *err = NULL;
+ sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_non_null(err);
- assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->code, BLOGC_ERROR_SOURCE_PARSER);
assert_string_equal(err->msg,
"Invalid configuration key.\n"
"Error occurred near line 1, position 4: BOLa");
- bc_error_free(err);
- bc_trie_free(source);
+ sb_error_free(err);
+ sb_trie_free(source);
}
@@ -281,15 +282,15 @@ static void
test_source_parse_config_no_key2(void **state)
{
const char *a = "BOLA";
- bc_error_t *err = NULL;
- bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ sb_error_t *err = NULL;
+ sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_non_null(err);
- assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->code, BLOGC_ERROR_SOURCE_PARSER);
assert_string_equal(err->msg,
"Your last configuration key is missing ':' and the value\n"
"Error occurred near line 1, position 5: BOLA");
- bc_error_free(err);
- bc_trie_free(source);
+ sb_error_free(err);
+ sb_trie_free(source);
}
@@ -298,12 +299,12 @@ test_source_parse_config_no_value(void **state)
{
// this is a special case, not an error
const char *a = "BOLA:\r\n";
- bc_error_t *err = NULL;
- bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ sb_error_t *err = NULL;
+ sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_non_null(source);
assert_null(err);
- assert_string_equal(bc_trie_lookup(source, "BOLA"), "");
- bc_trie_free(source);
+ assert_string_equal(sb_trie_lookup(source, "BOLA"), "");
+ sb_trie_free(source);
}
@@ -311,16 +312,16 @@ static void
test_source_parse_config_no_value2(void **state)
{
const char *a = "BOLA:";
- bc_error_t *err = NULL;
- bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ sb_error_t *err = NULL;
+ sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
- assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->code, BLOGC_ERROR_SOURCE_PARSER);
assert_string_equal(err->msg,
"Configuration value not provided for 'BOLA'.\n"
"Error occurred near line 1, position 6: BOLA:");
- bc_error_free(err);
- bc_trie_free(source);
+ sb_error_free(err);
+ sb_trie_free(source);
}
@@ -328,16 +329,16 @@ static void
test_source_parse_config_reserved_name(void **state)
{
const char *a = "FILENAME: asd\r\n";
- bc_error_t *err = NULL;
- bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ sb_error_t *err = NULL;
+ sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
- assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->code, BLOGC_ERROR_SOURCE_PARSER);
assert_string_equal(err->msg,
"'FILENAME' variable is forbidden in source files. It will be set "
"for you by the compiler.");
- bc_error_free(err);
- bc_trie_free(source);
+ sb_error_free(err);
+ sb_trie_free(source);
}
@@ -345,16 +346,16 @@ static void
test_source_parse_config_reserved_name2(void **state)
{
const char *a = "CONTENT: asd\r\n";
- bc_error_t *err = NULL;
- bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ sb_error_t *err = NULL;
+ sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
- assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->code, BLOGC_ERROR_SOURCE_PARSER);
assert_string_equal(err->msg,
"'CONTENT' variable is forbidden in source files. It will be set "
"for you by the compiler.");
- bc_error_free(err);
- bc_trie_free(source);
+ sb_error_free(err);
+ sb_trie_free(source);
}
@@ -362,16 +363,16 @@ static void
test_source_parse_config_reserved_name3(void **state)
{
const char *a = "DATE_FORMATTED: asd\r\n";
- bc_error_t *err = NULL;
- bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ sb_error_t *err = NULL;
+ sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
- assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->code, BLOGC_ERROR_SOURCE_PARSER);
assert_string_equal(err->msg,
"'DATE_FORMATTED' variable is forbidden in source files. It will be set "
"for you by the compiler.");
- bc_error_free(err);
- bc_trie_free(source);
+ sb_error_free(err);
+ sb_trie_free(source);
}
@@ -379,16 +380,16 @@ static void
test_source_parse_config_reserved_name4(void **state)
{
const char *a = "DATE_FIRST_FORMATTED: asd\r\n";
- bc_error_t *err = NULL;
- bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ sb_error_t *err = NULL;
+ sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
- assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->code, BLOGC_ERROR_SOURCE_PARSER);
assert_string_equal(err->msg,
"'DATE_FIRST_FORMATTED' variable is forbidden in source files. It will be set "
"for you by the compiler.");
- bc_error_free(err);
- bc_trie_free(source);
+ sb_error_free(err);
+ sb_trie_free(source);
}
@@ -396,16 +397,16 @@ static void
test_source_parse_config_reserved_name5(void **state)
{
const char *a = "DATE_LAST_FORMATTED: asd\r\n";
- bc_error_t *err = NULL;
- bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ sb_error_t *err = NULL;
+ sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
- assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->code, BLOGC_ERROR_SOURCE_PARSER);
assert_string_equal(err->msg,
"'DATE_LAST_FORMATTED' variable is forbidden in source files. It will be set "
"for you by the compiler.");
- bc_error_free(err);
- bc_trie_free(source);
+ sb_error_free(err);
+ sb_trie_free(source);
}
@@ -413,16 +414,16 @@ static void
test_source_parse_config_reserved_name6(void **state)
{
const char *a = "PAGE_FIRST: asd\r\n";
- bc_error_t *err = NULL;
- bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ sb_error_t *err = NULL;
+ sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
- assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->code, BLOGC_ERROR_SOURCE_PARSER);
assert_string_equal(err->msg,
"'PAGE_FIRST' variable is forbidden in source files. It will be set "
"for you by the compiler.");
- bc_error_free(err);
- bc_trie_free(source);
+ sb_error_free(err);
+ sb_trie_free(source);
}
@@ -430,16 +431,16 @@ static void
test_source_parse_config_reserved_name7(void **state)
{
const char *a = "PAGE_PREVIOUS: asd\r\n";
- bc_error_t *err = NULL;
- bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ sb_error_t *err = NULL;
+ sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
- assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->code, BLOGC_ERROR_SOURCE_PARSER);
assert_string_equal(err->msg,
"'PAGE_PREVIOUS' variable is forbidden in source files. It will be set "
"for you by the compiler.");
- bc_error_free(err);
- bc_trie_free(source);
+ sb_error_free(err);
+ sb_trie_free(source);
}
@@ -447,16 +448,16 @@ static void
test_source_parse_config_reserved_name8(void **state)
{
const char *a = "PAGE_CURRENT: asd\r\n";
- bc_error_t *err = NULL;
- bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ sb_error_t *err = NULL;
+ sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
- assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->code, BLOGC_ERROR_SOURCE_PARSER);
assert_string_equal(err->msg,
"'PAGE_CURRENT' variable is forbidden in source files. It will be set "
"for you by the compiler.");
- bc_error_free(err);
- bc_trie_free(source);
+ sb_error_free(err);
+ sb_trie_free(source);
}
@@ -464,16 +465,16 @@ static void
test_source_parse_config_reserved_name9(void **state)
{
const char *a = "PAGE_NEXT: asd\r\n";
- bc_error_t *err = NULL;
- bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ sb_error_t *err = NULL;
+ sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
- assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->code, BLOGC_ERROR_SOURCE_PARSER);
assert_string_equal(err->msg,
"'PAGE_NEXT' variable is forbidden in source files. It will be set "
"for you by the compiler.");
- bc_error_free(err);
- bc_trie_free(source);
+ sb_error_free(err);
+ sb_trie_free(source);
}
@@ -481,16 +482,16 @@ static void
test_source_parse_config_reserved_name10(void **state)
{
const char *a = "PAGE_LAST: asd\r\n";
- bc_error_t *err = NULL;
- bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ sb_error_t *err = NULL;
+ sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
- assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->code, BLOGC_ERROR_SOURCE_PARSER);
assert_string_equal(err->msg,
"'PAGE_LAST' variable is forbidden in source files. It will be set "
"for you by the compiler.");
- bc_error_free(err);
- bc_trie_free(source);
+ sb_error_free(err);
+ sb_trie_free(source);
}
@@ -498,16 +499,16 @@ static void
test_source_parse_config_reserved_name11(void **state)
{
const char *a = "BLOGC_VERSION: 1.0\r\n";
- bc_error_t *err = NULL;
- bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ sb_error_t *err = NULL;
+ sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
- assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->code, BLOGC_ERROR_SOURCE_PARSER);
assert_string_equal(err->msg,
"'BLOGC_VERSION' variable is forbidden in source files. It will be set "
"for you by the compiler.");
- bc_error_free(err);
- bc_trie_free(source);
+ sb_error_free(err);
+ sb_trie_free(source);
}
@@ -515,16 +516,16 @@ static void
test_source_parse_config_value_no_line_ending(void **state)
{
const char *a = "BOLA: asd";
- bc_error_t *err = NULL;
- bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ sb_error_t *err = NULL;
+ sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
- assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->code, BLOGC_ERROR_SOURCE_PARSER);
assert_string_equal(err->msg,
"No line ending after the configuration value for 'BOLA'.\n"
"Error occurred near line 1, position 10: BOLA: asd");
- bc_error_free(err);
- bc_trie_free(source);
+ sb_error_free(err);
+ sb_trie_free(source);
}
@@ -532,16 +533,16 @@ static void
test_source_parse_invalid_separator(void **state)
{
const char *a = "BOLA: asd\n---#";
- bc_error_t *err = NULL;
- bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ sb_error_t *err = NULL;
+ sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
- assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->code, BLOGC_ERROR_SOURCE_PARSER);
assert_string_equal(err->msg,
"Invalid content separator. Must be more than one '-' characters.\n"
"Error occurred near line 2, position 4: ---#");
- bc_error_free(err);
- bc_trie_free(source);
+ sb_error_free(err);
+ sb_trie_free(source);
}