mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-10 01:17:44 +03:00
Added unit test for strv_env_name_is_valid() function listed in env-util.c (#27100)
tests: add test for strv_env_name_is_valid function listed in env-util.c
(cherry picked from commit 6cc19afac1
)
This commit is contained in:
parent
0430078cfb
commit
eda7bf237f
@ -452,4 +452,13 @@ TEST(getenv_steal_erase) {
|
||||
assert_se(r > 0);
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
DEFINE_TEST_MAIN(LOG_DEBUG);
|
||||
|
Loading…
Reference in New Issue
Block a user