diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-11-15 16:55:22 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2024-01-03 18:38:46 +0100 |
commit | cb599f881a804eb3c9e3991e1e293d08bc7d9430 (patch) | |
tree | dcfa95119b5d55176b152522f0a2e94a77b30fa4 /src/test/test-strv.c | |
parent | Merge pull request #29940 from poettering/stub-confext-pickup (diff) | |
download | systemd-cb599f881a804eb3c9e3991e1e293d08bc7d9430.tar.xz systemd-cb599f881a804eb3c9e3991e1e293d08bc7d9430.zip |
strv: add new strv_endswith() helper
Diffstat (limited to '')
-rw-r--r-- | src/test/test-strv.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/test/test-strv.c b/src/test/test-strv.c index cfd662b329..f4a45703d0 100644 --- a/src/test/test-strv.c +++ b/src/test/test-strv.c @@ -1006,4 +1006,12 @@ TEST(strv_find_first_field) { assert_se(streq_ptr(strv_find_first_field(STRV_MAKE("i", "k", "l", "m", "d", "c", "a", "b"), haystack), "j")); } +TEST(strv_endswith) { + assert_se(streq_ptr(strv_endswith("waldo", STRV_MAKE("xxx", "yyy", "ldo", "zzz")), "ldo")); + assert_se(streq_ptr(strv_endswith("waldo", STRV_MAKE("xxx", "yyy", "zzz")), NULL)); + assert_se(streq_ptr(strv_endswith("waldo", STRV_MAKE("waldo")), "waldo")); + assert_se(streq_ptr(strv_endswith("waldo", STRV_MAKE("w", "o", "ldo")), "o")); + assert_se(streq_ptr(strv_endswith("waldo", STRV_MAKE("knurz", "", "waldo")), "")); +} + DEFINE_TEST_MAIN(LOG_INFO); |