summaryrefslogtreecommitdiff
path: root/src/test/test-env-replace.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/test-env-replace.c')
-rw-r--r--src/test/test-env-replace.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/test-env-replace.c b/src/test/test-env-replace.c
index d6cb2892e7..0274e97618 100644
--- a/src/test/test-env-replace.c
+++ b/src/test/test-env-replace.c
@@ -195,6 +195,15 @@ static void test_env_clean(void) {
assert_se(e[5] == NULL);
}
+static void test_env_name_is_valid(void) {
+ assert_se(env_name_is_valid("test"));
+
+ assert_se(!env_name_is_valid(NULL));
+ assert_se(!env_name_is_valid(""));
+ assert_se(!env_name_is_valid("5_starting_with_a_number_is_wrong"));
+ assert_se(!env_name_is_valid("#ยค%&?_only_numbers_letters_and_underscore_allowed"));
+}
+
int main(int argc, char *argv[]) {
test_strv_env_delete();
test_strv_env_unset();
@@ -203,6 +212,7 @@ int main(int argc, char *argv[]) {
test_replace_env_arg();
test_normalize_env_assignment();
test_env_clean();
+ test_env_name_is_valid();
return 0;
}