From 3f6ae823cd8ff8049abeca2be495c727563c919e Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Sat, 11 Feb 2023 23:18:51 +0100 Subject: make: fix global variable name validation --- tests/blogc-make/check_settings.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'tests') diff --git a/tests/blogc-make/check_settings.c b/tests/blogc-make/check_settings.c index d942c45..b268570 100644 --- a/tests/blogc-make/check_settings.c +++ b/tests/blogc-make/check_settings.c @@ -53,6 +53,40 @@ test_settings(void **state) assert_string_equal(err->msg, "[global] key required but not found or empty: AUTHOR_NAME"); bc_error_free(err); + + a = + "[settings]\n" + "content_dir = guda\n" + "main_template = foo.tmpl\n" + "\n" + "[global]\n" + "bOLA = asd\n" + "GUDA = qwe\n"; + err = NULL; + s = bm_settings_parse(a, strlen(a), &err); + assert_non_null(err); + assert_null(s); + assert_int_equal(err->type, BLOGC_MAKE_ERROR_SETTINGS); + assert_string_equal(err->msg, + "Invalid [global] key (first character must be uppercase): bOLA"); + bc_error_free(err); + + a = + "[settings]\n" + "content_dir = guda\n" + "main_template = foo.tmpl\n" + "\n" + "[global]\n" + "BOLA = asd\n" + "GUDa = qwe\n"; + err = NULL; + s = bm_settings_parse(a, strlen(a), &err); + assert_non_null(err); + assert_null(s); + assert_int_equal(err->type, BLOGC_MAKE_ERROR_SETTINGS); + assert_string_equal(err->msg, + "Invalid [global] key (must be uppercase with '_' and digits after first character): GUDa"); + bc_error_free(err); } -- cgit v1.2.3-18-g5258