aboutsummaryrefslogtreecommitdiffstats
path: root/tests/check_source_parser.c
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2015-08-14 11:36:18 -0300
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2015-08-14 11:36:18 -0300
commit451752b5436f661879b8a3e9d1770d1e1239a257 (patch)
tree68ca24b4b03a580d4b9a34c7340c1c91ef2322ce /tests/check_source_parser.c
parent77ec9dd19ae8445735781840c9b9b535afa0a12a (diff)
downloadblogc-451752b5436f661879b8a3e9d1770d1e1239a257.tar.gz
blogc-451752b5436f661879b8a3e9d1770d1e1239a257.tar.bz2
blogc-451752b5436f661879b8a3e9d1770d1e1239a257.zip
source-parser: forbid BLOGC_VERSION variable in source files
Diffstat (limited to 'tests/check_source_parser.c')
-rw-r--r--tests/check_source_parser.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/check_source_parser.c b/tests/check_source_parser.c
index 79ca10f..0299c16 100644
--- a/tests/check_source_parser.c
+++ b/tests/check_source_parser.c
@@ -392,6 +392,23 @@ test_source_parse_config_reserved_name10(void **state)
static void
+test_source_parse_config_reserved_name11(void **state)
+{
+ const char *a = "BLOGC_VERSION: 1.0\r\n";
+ blogc_error_t *err = NULL;
+ b_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_string_equal(err->msg,
+ "'BLOGC_VERSION' variable is forbidden in source files. It will be set "
+ "for you by the compiler.");
+ blogc_error_free(err);
+ b_trie_free(source);
+}
+
+
+static void
test_source_parse_config_value_no_line_ending(void **state)
{
const char *a = "BOLA: asd";
@@ -447,6 +464,7 @@ main(void)
unit_test(test_source_parse_config_reserved_name8),
unit_test(test_source_parse_config_reserved_name9),
unit_test(test_source_parse_config_reserved_name10),
+ unit_test(test_source_parse_config_reserved_name11),
unit_test(test_source_parse_config_value_no_line_ending),
unit_test(test_source_parse_invalid_separator),
};