aboutsummaryrefslogtreecommitdiffstats
path: root/tests/check_source_parser.c
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2016-04-27 01:31:02 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2016-04-27 01:31:02 +0200
commit6153580a13e7e7c48e38fa446572c8adcae08084 (patch)
tree9be08616aed124c67159bf71fccd3a286bc0fe81 /tests/check_source_parser.c
parentc5e4f4c2d29831151bdce1802787b9cf012c3e5e (diff)
downloadblogc-6153580a13e7e7c48e38fa446572c8adcae08084.tar.gz
blogc-6153580a13e7e7c48e38fa446572c8adcae08084.tar.bz2
blogc-6153580a13e7e7c48e38fa446572c8adcae08084.zip
Revert "*: use squareball error infrastructure"
This reverts commit a2b3551dfb9460470bd79f5648bf597c517c40d4.
Diffstat (limited to 'tests/check_source_parser.c')
-rw-r--r--tests/check_source_parser.c122
1 files changed, 61 insertions, 61 deletions
diff --git a/tests/check_source_parser.c b/tests/check_source_parser.c
index a2a3ddc..0f891dd 100644
--- a/tests/check_source_parser.c
+++ b/tests/check_source_parser.c
@@ -30,7 +30,7 @@ test_source_parse(void **state)
"# This is a test\n"
"\n"
"bola\n";
- sb_error_t *err = NULL;
+ blogc_error_t *err = NULL;
sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(err);
assert_non_null(source);
@@ -62,7 +62,7 @@ test_source_parse_crlf(void **state)
"# This is a test\r\n"
"\r\n"
"bola\r\n";
- sb_error_t *err = NULL;
+ blogc_error_t *err = NULL;
sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(err);
assert_non_null(source);
@@ -96,7 +96,7 @@ test_source_parse_with_spaces(void **state)
"# This is a test\n"
"\n"
"bola\n";
- sb_error_t *err = NULL;
+ blogc_error_t *err = NULL;
sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(err);
assert_non_null(source);
@@ -133,7 +133,7 @@ test_source_parse_with_excerpt(void **state)
"\n"
"guda\n"
"yay";
- sb_error_t *err = NULL;
+ blogc_error_t *err = NULL;
sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(err);
assert_non_null(source);
@@ -199,13 +199,13 @@ static void
test_source_parse_config_empty(void **state)
{
const char *a = "";
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
assert_string_equal(err->msg, "Your source file is empty.");
- sb_error_free(err);
+ blogc_error_free(err);
sb_trie_free(source);
}
@@ -214,14 +214,14 @@ static void
test_source_parse_config_invalid_key(void **state)
{
const char *a = "bola: guda";
- sb_error_t *err = NULL;
+ blogc_error_t *err = NULL;
sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_non_null(err);
- assert_int_equal(err->code, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->type, 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");
- sb_error_free(err);
+ blogc_error_free(err);
sb_trie_free(source);
}
@@ -230,14 +230,14 @@ static void
test_source_parse_config_no_key(void **state)
{
const char *a = "BOLa";
- sb_error_t *err = NULL;
+ blogc_error_t *err = NULL;
sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_non_null(err);
- assert_int_equal(err->code, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
assert_string_equal(err->msg,
"Invalid configuration key.\n"
"Error occurred near line 1, position 4: BOLa");
- sb_error_free(err);
+ blogc_error_free(err);
sb_trie_free(source);
}
@@ -246,14 +246,14 @@ static void
test_source_parse_config_no_key2(void **state)
{
const char *a = "BOLA";
- sb_error_t *err = NULL;
+ blogc_error_t *err = NULL;
sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_non_null(err);
- assert_int_equal(err->code, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->type, 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");
- sb_error_free(err);
+ blogc_error_free(err);
sb_trie_free(source);
}
@@ -262,15 +262,15 @@ static void
test_source_parse_config_no_value(void **state)
{
const char *a = "BOLA:\r\n";
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
assert_string_equal(err->msg,
"Configuration value not provided for 'BOLA'.\n"
"Error occurred near line 1, position 6: BOLA:");
- sb_error_free(err);
+ blogc_error_free(err);
sb_trie_free(source);
}
@@ -279,15 +279,15 @@ static void
test_source_parse_config_no_value2(void **state)
{
const char *a = "BOLA:";
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
assert_string_equal(err->msg,
"Configuration value not provided for 'BOLA'.\n"
"Error occurred near line 1, position 6: BOLA:");
- sb_error_free(err);
+ blogc_error_free(err);
sb_trie_free(source);
}
@@ -296,15 +296,15 @@ static void
test_source_parse_config_reserved_name(void **state)
{
const char *a = "FILENAME: asd\r\n";
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->type, 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.");
- sb_error_free(err);
+ blogc_error_free(err);
sb_trie_free(source);
}
@@ -313,15 +313,15 @@ static void
test_source_parse_config_reserved_name2(void **state)
{
const char *a = "CONTENT: asd\r\n";
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->type, 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.");
- sb_error_free(err);
+ blogc_error_free(err);
sb_trie_free(source);
}
@@ -330,15 +330,15 @@ static void
test_source_parse_config_reserved_name3(void **state)
{
const char *a = "DATE_FORMATTED: asd\r\n";
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->type, 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.");
- sb_error_free(err);
+ blogc_error_free(err);
sb_trie_free(source);
}
@@ -347,15 +347,15 @@ static void
test_source_parse_config_reserved_name4(void **state)
{
const char *a = "DATE_FIRST_FORMATTED: asd\r\n";
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->type, 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.");
- sb_error_free(err);
+ blogc_error_free(err);
sb_trie_free(source);
}
@@ -364,15 +364,15 @@ static void
test_source_parse_config_reserved_name5(void **state)
{
const char *a = "DATE_LAST_FORMATTED: asd\r\n";
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->type, 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.");
- sb_error_free(err);
+ blogc_error_free(err);
sb_trie_free(source);
}
@@ -381,15 +381,15 @@ static void
test_source_parse_config_reserved_name6(void **state)
{
const char *a = "PAGE_FIRST: asd\r\n";
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->type, 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.");
- sb_error_free(err);
+ blogc_error_free(err);
sb_trie_free(source);
}
@@ -398,15 +398,15 @@ static void
test_source_parse_config_reserved_name7(void **state)
{
const char *a = "PAGE_PREVIOUS: asd\r\n";
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->type, 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.");
- sb_error_free(err);
+ blogc_error_free(err);
sb_trie_free(source);
}
@@ -415,15 +415,15 @@ static void
test_source_parse_config_reserved_name8(void **state)
{
const char *a = "PAGE_CURRENT: asd\r\n";
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->type, 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.");
- sb_error_free(err);
+ blogc_error_free(err);
sb_trie_free(source);
}
@@ -432,15 +432,15 @@ static void
test_source_parse_config_reserved_name9(void **state)
{
const char *a = "PAGE_NEXT: asd\r\n";
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->type, 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.");
- sb_error_free(err);
+ blogc_error_free(err);
sb_trie_free(source);
}
@@ -449,15 +449,15 @@ static void
test_source_parse_config_reserved_name10(void **state)
{
const char *a = "PAGE_LAST: asd\r\n";
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->type, 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.");
- sb_error_free(err);
+ blogc_error_free(err);
sb_trie_free(source);
}
@@ -466,15 +466,15 @@ static void
test_source_parse_config_reserved_name11(void **state)
{
const char *a = "BLOGC_VERSION: 1.0\r\n";
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->type, 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.");
- sb_error_free(err);
+ blogc_error_free(err);
sb_trie_free(source);
}
@@ -483,15 +483,15 @@ static void
test_source_parse_config_value_no_line_ending(void **state)
{
const char *a = "BOLA: asd";
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->type, 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");
- sb_error_free(err);
+ blogc_error_free(err);
sb_trie_free(source);
}
@@ -500,15 +500,15 @@ static void
test_source_parse_invalid_separator(void **state)
{
const char *a = "BOLA: asd\n---#";
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_ERROR_SOURCE_PARSER);
+ assert_int_equal(err->type, 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: ---#");
- sb_error_free(err);
+ blogc_error_free(err);
sb_trie_free(source);
}