From 6e884f6a7b0c42027eb043e6a353ab8616f41cc6 Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Sat, 6 Sep 2014 12:40:11 +0200 Subject: [PATCH] Added more test cases for multiple * and ? in pattern. --- tests/test-util.c | 6 ++++++ 1 file changed, 6 insertions(+) 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[]) -- 2.20.1