diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-10-25 19:01:19 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-10-31 03:02:35 +0100 |
commit | 7633001cddc2ddd906f39826be35cff20a327543 (patch) | |
tree | e2e22f38d29178020f2cc86b17c0068be08ee4ec /src/test | |
parent | env-util: replace 'char **' with 'char**' (diff) | |
download | systemd-7633001cddc2ddd906f39826be35cff20a327543.tar.xz systemd-7633001cddc2ddd906f39826be35cff20a327543.zip |
env-util: introduce strv_env_get_merged()
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test-env-util.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/test-env-util.c b/src/test/test-env-util.c index e2c009dc9c..7eda66bd3e 100644 --- a/src/test/test-env-util.c +++ b/src/test/test-env-util.c @@ -581,4 +581,15 @@ TEST(getenv_path_list) { assert_se(unsetenv("TEST_GETENV_PATH_LIST") >= 0); } +TEST(strv_env_get_merged) { + char **l = STRV_MAKE("ONE", "1", "TWO", "2", "THREE", "3", "FOUR", "4", "FIVE", "5"), + **expected = STRV_MAKE("ONE=1", "TWO=2", "THREE=3", "FOUR=4", "FIVE=5"); + _cleanup_strv_free_ char **m = NULL; + + ASSERT_OK(strv_env_get_merged(NULL, &m)); + ASSERT_NULL(m); + ASSERT_OK(strv_env_get_merged(l, &m)); + ASSERT_TRUE(strv_equal(m, expected)); +} + DEFINE_TEST_MAIN(LOG_DEBUG); |