blob: c060fd3e9a6fe6cf7e4e14727b017eb5ffe72323 [file] [log] [blame]
Wayne Davison97d53f82003-07-06 17:41:01 +00001# Input is in the following format (all items white-space separated):
2#
Wayne Davison85b80fb2003-07-07 07:10:40 +00003# The first two items are 1 or 0 indicating if the wildmat call is expected to
4# succeed and if fnmatch works the same way as wildmat, respectively. After
5# that is a text string for the match, and a pattern string. Strings can be
6# quoted (if desired) in either double or single quotes, as well as backticks.
Wayne Davison97d53f82003-07-06 17:41:01 +00007#
8# MATCH FNMATCH_SAME "text to match" 'pattern to use'
9
10# Basic wildmat features
111 1 foo foo
120 1 foo bar
131 1 '' ""
141 1 foo ???
150 1 foo ??
161 1 foo *
171 1 foo f*
180 1 foo *f
191 1 foo *foo*
201 1 foobar *ob*a*r*
211 1 aaaaaaabababab *ab
221 1 foo* foo\*
230 1 foobar foo\*bar
241 1 f\oo f\\oo
251 1 ball *[al]?
260 1 ten [ten]
271 1 ten **[!te]
280 1 ten **[!ten]
291 1 ten t[a-g]n
300 1 ten t[!a-g]n
311 1 ton t[!a-g]n
321 1 ton t[^a-g]n
331 1 a]b a[]]b
341 1 a-b a[]-]b
351 1 a]b a[]-]b
360 1 aab a[]-]b
371 1 aab a[]a-]b
381 1 ] ]
39
40# Extended slash-matching features
410 1 foo/baz/bar foo*bar
421 1 foo/baz/bar foo**bar
430 1 foo/bar foo?bar
Wayne Davison3c30b992003-07-14 15:46:34 +0000440 1 foo/bar foo[/]bar
450 1 foo/bar f[^eiu][^eiu][^eiu][^eiu][^eiu]r
461 1 foo-bar f[^eiu][^eiu][^eiu][^eiu][^eiu]r
Wayne Davison97d53f82003-07-06 17:41:01 +0000470 1 foo **/foo
481 1 /foo **/foo
491 1 bar/baz/foo **/foo
500 1 bar/baz/foo */foo
510 0 foo/bar/baz **/bar*
Wayne Davison85b80fb2003-07-07 07:10:40 +0000521 1 deep/foo/bar/baz **/bar/*
Wayne Davison97d53f82003-07-06 17:41:01 +0000531 1 foo/bar/baz **/bar**
Wayne Davison85b80fb2003-07-07 07:10:40 +0000541 1 foo/bar/baz/x */bar/**
550 0 deep/foo/bar/baz/x */bar/**
561 1 deep/foo/bar/baz/x **/bar/*/*
Wayne Davison97d53f82003-07-06 17:41:01 +000057
58# Various additional tests
590 1 acrt a[c-c]st
Wayne Davison85b80fb2003-07-07 07:10:40 +0000601 1 acrt a[c-c]rt
Wayne Davison97d53f82003-07-06 17:41:01 +0000610 1 ] [!]-]
621 1 a [!]-]
630 1 '' \
640 1 \ \
Wayne Davison85b80fb2003-07-07 07:10:40 +0000650 1 /\ */\
661 1 /\ */\\
Wayne Davison97d53f82003-07-06 17:41:01 +0000671 1 foo foo
681 1 @foo @foo
690 1 foo @foo
701 1 [ab] \[ab]
Wayne Davison85b80fb2003-07-07 07:10:40 +0000711 1 [ab] [[]ab]
721 1 [ab] [[:]ab]
730 1 [ab] [[::]ab]
741 1 [ab] [[:digit]ab]
751 1 [ab] [\[:]ab]
Wayne Davison97d53f82003-07-06 17:41:01 +0000761 1 ?a?b \??\?b
771 1 abc \a\b\c
780 1 foo ''
791 1 foo/bar/baz/to **/t[o]
80
81# Character class tests
821 1 a1B [[:alpha:]][[:digit:]][[:upper:]]
830 1 a [[:digit:][:upper:][:space:]]
841 1 A [[:digit:][:upper:][:space:]]
851 1 1 [[:digit:][:upper:][:space:]]
Wayne Davison85b80fb2003-07-07 07:10:40 +0000860 1 1 [[:digit:][:upper:][:spaci:]]
Wayne Davison97d53f82003-07-06 17:41:01 +0000871 1 ' ' [[:digit:][:upper:][:space:]]
880 1 . [[:digit:][:upper:][:space:]]
Wayne Davison15bb9972003-07-06 18:54:08 +0000891 1 . [[:digit:][:punct:][:space:]]
Wayne Davison97d53f82003-07-06 17:41:01 +0000901 1 5 [[:xdigit:]]
911 1 f [[:xdigit:]]
921 1 D [[:xdigit:]]
Wayne Davison15bb9972003-07-06 18:54:08 +0000931 1 _ [[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:graph:][:lower:][:print:][:punct:][:space:][:upper:][:xdigit:]]
Wayne Davisonb7db0902003-07-07 07:28:02 +000094#1 1 … [^[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:graph:][:lower:][:print:][:punct:][:space:][:upper:][:xdigit:]]
Wayne Davison15bb9972003-07-06 18:54:08 +0000951 1  [^[:alnum:][:alpha:][:blank:][:digit:][:graph:][:lower:][:print:][:punct:][:space:][:upper:][:xdigit:]]
961 1 . [^[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:lower:][:space:][:upper:][:xdigit:]]
Wayne Davison85b80fb2003-07-07 07:10:40 +0000971 1 5 [a-c[:digit:]x-z]
981 1 b [a-c[:digit:]x-z]
991 1 y [a-c[:digit:]x-z]
1000 1 q [a-c[:digit:]x-z]
Wayne Davison97d53f82003-07-06 17:41:01 +0000101
102# Additional tests, including some malformed wildmats
1031 1 ] [\\-^]
1040 1 [ [\\-^]
1051 1 - [\-_]
1061 1 ] [\]]
1070 1 \] [\]]
1080 1 \ [\]]
1090 1 ab a[]b
1100 1 a[]b a[]b
1110 1 ab[ ab[
1120 1 ab [!
1130 1 ab [-
1141 1 - [-]
1150 1 - [a-
1160 1 - [!a-
1171 1 - [--A]
1181 1 5 [--A]
1191 1 ' ' '[ --]'
1201 1 $ '[ --]'
1211 1 - '[ --]'
1220 1 0 '[ --]'
1231 1 - [---]
1241 1 - [------]
1250 1 j [a-e-n]
1261 1 - [a-e-n]
1271 1 a [!------]
1280 1 [ []-a]
1291 1 ^ []-a]
1300 1 ^ [!]-a]
1311 1 [ [!]-a]
1321 1 ^ [a^bc]
1331 1 -b] [a-]b]
1340 1 \ [\]
1351 1 \ [\\]
1360 1 \ [!\\]
1371 1 G [A-\\]
1380 1 aaabbb b*a
1390 1 aabcaa *ba*
1401 1 , [,]
1411 1 , [\\,]
1421 1 \ [\\,]
1431 1 - [,-.]
1440 1 + [,-.]
1450 1 -.] [,-.]
Wayne Davison85b80fb2003-07-07 07:10:40 +00001461 1 2 [\1-\3]
1471 1 3 [\1-\3]
1480 1 4 [\1-\3]
Wayne Davison97d53f82003-07-06 17:41:01 +00001491 1 \ [[-\]]
Wayne Davison85b80fb2003-07-07 07:10:40 +00001501 1 [ [[-\]]
1511 1 ] [[-\]]
Wayne Davison97d53f82003-07-06 17:41:01 +00001520 1 - [[-\]]
153
Wayne Davison15bb9972003-07-06 18:54:08 +0000154# Test recursion and the abort code (use "wildtest -i" to see iteration counts)
Wayne Davison97d53f82003-07-06 17:41:01 +00001551 1 -adobe-courier-bold-o-normal--12-120-75-75-m-70-iso8859-1 -*-*-*-*-*-*-12-*-*-*-m-*-*-*
1560 1 -adobe-courier-bold-o-normal--12-120-75-75-X-70-iso8859-1 -*-*-*-*-*-*-12-*-*-*-m-*-*-*
1570 1 -adobe-courier-bold-o-normal--12-120-75-75-/-70-iso8859-1 -*-*-*-*-*-*-12-*-*-*-m-*-*-*
1581 1 /adobe/courier/bold/o/normal//12/120/75/75/m/70/iso8859/1 /*/*/*/*/*/*/12/*/*/*/m/*/*/*
1590 1 /adobe/courier/bold/o/normal//12/120/75/75/X/70/iso8859/1 /*/*/*/*/*/*/12/*/*/*/m/*/*/*
1601 1 abcd/abcdefg/abcdefghijk/abcdefghijklmnop.txt **/*a*b*g*n*t
Wayne Davison15bb9972003-07-06 18:54:08 +00001610 1 abcd/abcdefg/abcdefghijk/abcdefghijklmnop.txtz **/*a*b*g*n*t