summaryrefslogtreecommitdiff
path: root/src/test/test-strv.c
diff options
context:
space:
mode:
authorEvgeny Vereshchagin <evvers@ya.ru>2016-06-27 15:47:37 +0300
committerMartin Pitt <martin.pitt@ubuntu.com>2016-06-27 14:47:37 +0200
commit2027927b1002a74d24300704a655614f8ea48e45 (patch)
tree6d11bcf50cd8a1b5a40b6cab488996203bfe4e94 /src/test/test-strv.c
parentbed48d665599fca9ac44f3bb330087c80edb01c7 (diff)
basic: pass flags to the fnmatch (#3606)
Fixes: ``` $ systemctl list-unit-files 'hey\*' 0 unit files listed. $ systemctl list-unit-files | grep hey hey\x7eho.service static ```
Diffstat (limited to 'src/test/test-strv.c')
-rw-r--r--src/test/test-strv.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/test-strv.c b/src/test/test-strv.c
index fc01dcfaf1..cf5887d258 100644
--- a/src/test/test-strv.c
+++ b/src/test/test-strv.c
@@ -685,6 +685,16 @@ static void test_foreach_string(void) {
assert_se(streq(x, "zzz"));
}
+static void test_strv_fnmatch(void) {
+ _cleanup_free_ char **v = NULL;
+
+ assert_se(!strv_fnmatch(STRV_MAKE_EMPTY, "a", 0));
+
+ v = strv_new("*\\*", NULL);
+ assert_se(!strv_fnmatch(v, "\\", 0));
+ assert_se(strv_fnmatch(v, "\\", FNM_NOESCAPE));
+}
+
int main(int argc, char *argv[]) {
test_specifier_printf();
test_strv_foreach();
@@ -750,6 +760,7 @@ int main(int argc, char *argv[]) {
test_strv_make_nulstr();
test_foreach_string();
+ test_strv_fnmatch();
return 0;
}