diff options
author | Daniel Carl <danielcarl@gmx.de> | 2014-09-06 12:40:11 +0200 |
---|---|---|
committer | Daniel Carl <danielcarl@gmx.de> | 2014-09-06 12:40:11 +0200 |
commit | 6e884f6a7b0c42027eb043e6a353ab8616f41cc6 (patch) | |
tree | 97c3a31b01a173b62965a96f372a19cd4db78288 /tests | |
parent | c25cbaf137db6e2d128c3741cda0c15208823aaf (diff) |
Added more test cases for multiple * and ? in pattern.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-util.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/test-util.c b/tests/test-util.c index cd80420..a8d42f7 100644 --- a/tests/test-util.c +++ b/tests/test-util.c @@ -169,6 +169,7 @@ static void test_wildmatch_questionmark(void) g_assert_false(util_wildmatch("foo\\?bar", "foorbar")); g_assert_false(util_wildmatch("?", "")); + g_assert_false(util_wildmatch("b??r", "bar")); } static void test_wildmatch_wildcard(void) @@ -181,8 +182,13 @@ static void test_wildmatch_wildcard(void) g_assert_true(util_wildmatch("match\\*", "match*")); g_assert_true(util_wildmatch("do * match", "do a infix match")); g_assert_true(util_wildmatch("*://*.io/*", "http://fanglingsu.github.io/vimb/")); + /* multiple * should act like a single one */ + g_assert_true(util_wildmatch("**", "")); + g_assert_true(util_wildmatch("match **", "Match as much as possible")); + g_assert_true(util_wildmatch("f***u", "fu")); g_assert_false(util_wildmatch("match\\*", "match fail")); + g_assert_false(util_wildmatch("f***u", "full")); } int main(int argc, char *argv[]) |