From f488e6473a7d0562c0e2df6d107a36de4d30d9da Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 14 Sep 2019 21:44:24 +0300 Subject: Add support for bracket expressions in wildcard pattern matching --- tests/wildcard/testscript | 70 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 2 deletions(-) (limited to 'tests/wildcard/testscript') diff --git a/tests/wildcard/testscript b/tests/wildcard/testscript index a7ddb1a..4b88427 100644 --- a/tests/wildcard/testscript +++ b/tests/wildcard/testscript @@ -75,17 +75,76 @@ } } + : bracket + : + { + : ordinary-char + : + { + $* a[bc]d abd : first + $* a[0-9b]d abd : after-range + $* a[bc]d acd : last + $* a[]bc]d a]d : closing-bracket + $* a[-bc]d a-d : first-dash + $* a[bc-]d a-d : last-dash + $* a[*]d a*d : star + $* a[?]d a?d : question + $* a[[]d a[d : open-bracket + $* a[xy]d abd == 1 : not-match + + : not-expr + : + { + $* a[b a[b : not-closed + $* a[!b a[!b : not-closed-inverse + $* a[]b a[]b : empty + $* a[!] a[!] : empty-inverse + } + } + + : range + : + { + $* a[0-8]d a0d : min + $* a[0-8]d a8d : max + $* a[0-8]d a5d : mid + $* a[0-8]d a9d == 1 : out + $* a[a0-8]d a1d : after-char + $* a[x0-9y]d abd == 1 : not-match + } + + : inverse + : + { + $* a[!xy]d abd : match + $* a[!ab]d abd == 1 : not-match + } + } + + : mixed + : + : Test patterns combining backtracking with the bracket expressions. + : + { + $* [0-9]a*b 9axb : bracket-star + $* a*b[0-9] axyb0 : star-bracket + $* a*b[0-9]x*y ab1xzy : star-bracket-star + $* a*[0-9]x*y[a-z] ax2xyb : star-bracket-star-bracket + } + : case-sensitivity : : Test that matching is case-insensitive on Windows and sensitive otherwise. : if ($cxx.target.class != 'windows') { - $* F*O/ foo/ == 1 + $* F*O/ foo/ == 1 + $* f[A-Z]o/ foo/ == 1 } else { - $* F*O/ foo/ + $* F*O/ foo/ + $* f[A-Z]o/ foo/ } } @@ -161,6 +220,13 @@ baz EOO + : recursive-with-brackets + : + $* **[!xy][rz] ../foo >>/EOO + bar/bar + baz + EOO + : self-recursive : { -- cgit v1.1