From da5f4b1d84a6aef9ae35274a417f8fb3853a4a90 Mon Sep 17 00:00:00 2001 From: Patrick Monnerat Date: Tue, 30 Jan 2018 20:22:17 +0100 Subject: fnmatch: pattern syntax can no longer fail Whenever an expected pattern syntax rule cannot be matched, the character starting the rule loses its special meaning and the parsing is resumed: - backslash at the end of pattern string matches itself. - Error in [:keyword:] results in set containing :\[dekorwy. Unit test 1307 updated for this new situation. Closes #2273 --- tests/unit/unit1307.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests/unit/unit1307.c') diff --git a/tests/unit/unit1307.c b/tests/unit/unit1307.c index 5aa23d0dc..0d2257bf0 100644 --- a/tests/unit/unit1307.c +++ b/tests/unit/unit1307.c @@ -25,7 +25,6 @@ #define MATCH CURL_FNMATCH_MATCH #define NOMATCH CURL_FNMATCH_NOMATCH -#define RE_ERR CURL_FNMATCH_FAIL struct testcase { const char *pattern; @@ -135,6 +134,8 @@ static const struct testcase tests[] = { { "[^[:blank:]]", "\t", NOMATCH }, { "[^[:print:]]", "\10", MATCH }, { "[[:lower:]][[:lower:]]", "ll", MATCH }, + { "[[:foo:]]", "bar", NOMATCH }, + { "[[:foo:]]", "f]", MATCH }, { "Curl[[:blank:]];-)", "Curl ;-)", MATCH }, { "*[[:blank:]]*", " ", MATCH }, @@ -172,7 +173,7 @@ static const struct testcase tests[] = { { "x", "", NOMATCH }, /* backslash */ - { "\\", "\\", RE_ERR }, + { "\\", "\\", MATCH }, { "\\\\", "\\", MATCH }, { "\\\\", "\\\\", NOMATCH }, { "\\?", "?", MATCH }, -- cgit v1.2.3