]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Modified to use STRV_MAKE() in strv_env_name_is_valid() function listed in env-util.c
authorTanishka <tanishkasingh2004@gmail.com>
Tue, 4 Apr 2023 13:00:31 +0000 (18:30 +0530)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 11 Apr 2023 19:05:22 +0000 (21:05 +0200)
src/test/test-env-util.c

index bcc98ae88ab14e3cd0eed57383ff85926266764c..8f2293b6c0bcb7092ab2ac212a4ddc9eb89cdc6d 100644 (file)
@@ -479,12 +479,9 @@ TEST(getenv_steal_erase) {
 }
 
 TEST(strv_env_name_is_valid) {
-        const char *valid_env_names[] = {"HOME", "USER", "SHELL", "PATH", NULL};
-        const char *invalid_env_names[] = {"", "PATH", "home", "user", "SHELL", NULL};
-        const char *repeated_env_names[] = {"HOME", "USER", "SHELL", "USER", NULL};
-        assert_se(strv_env_name_is_valid((char **) valid_env_names));
-        assert_se(!strv_env_name_is_valid((char **) invalid_env_names));
-        assert_se(!strv_env_name_is_valid((char **) repeated_env_names));
+        assert_se(strv_env_name_is_valid(STRV_MAKE("HOME", "USER", "SHELL", "PATH")));
+        assert_se(!strv_env_name_is_valid(STRV_MAKE("", "PATH", "home", "user", "SHELL")));
+        assert_se(!strv_env_name_is_valid(STRV_MAKE("HOME", "USER", "SHELL", "USER")));
 }
 
 DEFINE_TEST_MAIN(LOG_DEBUG);