t / t3070 / wildtest.txton commit wildmatch: follow Git's coding convention (327f2f3)
   1# Input is in the following format (all items white-space separated):
   2#
   3# 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.
   7#
   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
  440 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
  470 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*
  521 1 deep/foo/bar/baz    **/bar/*
  530 1 deep/foo/bar/baz/   **/bar/*
  541 1 deep/foo/bar/baz/   **/bar/**
  550 1 deep/foo/bar        **/bar/*
  561 1 deep/foo/bar/       **/bar/**
  571 1 foo/bar/baz         **/bar**
  581 1 foo/bar/baz/x       */bar/**
  590 0 deep/foo/bar/baz/x  */bar/**
  601 1 deep/foo/bar/baz/x  **/bar/*/*
  61
  62# Various additional tests
  630 1 acrt                a[c-c]st
  641 1 acrt                a[c-c]rt
  650 1 ]                   [!]-]
  661 1 a                   [!]-]
  670 1 ''                  \
  680 1 \                   \
  690 1 /\                  */\
  701 1 /\                  */\\
  711 1 foo                 foo
  721 1 @foo                @foo
  730 1 foo                 @foo
  741 1 [ab]                \[ab]
  751 1 [ab]                [[]ab]
  761 1 [ab]                [[:]ab]
  770 1 [ab]                [[::]ab]
  781 1 [ab]                [[:digit]ab]
  791 1 [ab]                [\[:]ab]
  801 1 ?a?b                \??\?b
  811 1 abc                 \a\b\c
  820 1 foo                 ''
  831 1 foo/bar/baz/to      **/t[o]
  84
  85# Character class tests
  861 1 a1B         [[:alpha:]][[:digit:]][[:upper:]]
  870 1 a           [[:digit:][:upper:][:space:]]
  881 1 A           [[:digit:][:upper:][:space:]]
  891 1 1           [[:digit:][:upper:][:space:]]
  900 1 1           [[:digit:][:upper:][:spaci:]]
  911 1 ' '         [[:digit:][:upper:][:space:]]
  920 1 .           [[:digit:][:upper:][:space:]]
  931 1 .           [[:digit:][:punct:][:space:]]
  941 1 5           [[:xdigit:]]
  951 1 f           [[:xdigit:]]
  961 1 D           [[:xdigit:]]
  971 1 _           [[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:graph:][:lower:][:print:][:punct:][:space:][:upper:][:xdigit:]]
  98#1 1 \85         [^[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:graph:][:lower:][:print:][:punct:][:space:][:upper:][:xdigit:]]
  991 1 \7f           [^[:alnum:][:alpha:][:blank:][:digit:][:graph:][:lower:][:print:][:punct:][:space:][:upper:][:xdigit:]]
 1001 1 .           [^[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:lower:][:space:][:upper:][:xdigit:]]
 1011 1 5           [a-c[:digit:]x-z]
 1021 1 b           [a-c[:digit:]x-z]
 1031 1 y           [a-c[:digit:]x-z]
 1040 1 q           [a-c[:digit:]x-z]
 105
 106# Additional tests, including some malformed wildmats
 1071 1 ]           [\\-^]
 1080 1 [           [\\-^]
 1091 1 -           [\-_]
 1101 1 ]           [\]]
 1110 1 \]          [\]]
 1120 1 \           [\]]
 1130 1 ab          a[]b
 1140 1 a[]b        a[]b
 1150 1 ab[         ab[
 1160 1 ab          [!
 1170 1 ab          [-
 1181 1 -           [-]
 1190 1 -           [a-
 1200 1 -           [!a-
 1211 1 -           [--A]
 1221 1 5           [--A]
 1231 1 ' '         '[ --]'
 1241 1 $           '[ --]'
 1251 1 -           '[ --]'
 1260 1 0           '[ --]'
 1271 1 -           [---]
 1281 1 -           [------]
 1290 1 j           [a-e-n]
 1301 1 -           [a-e-n]
 1311 1 a           [!------]
 1320 1 [           []-a]
 1331 1 ^           []-a]
 1340 1 ^           [!]-a]
 1351 1 [           [!]-a]
 1361 1 ^           [a^bc]
 1371 1 -b]         [a-]b]
 1380 1 \           [\]
 1391 1 \           [\\]
 1400 1 \           [!\\]
 1411 1 G           [A-\\]
 1420 1 aaabbb      b*a
 1430 1 aabcaa      *ba*
 1441 1 ,           [,]
 1451 1 ,           [\\,]
 1461 1 \           [\\,]
 1471 1 -           [,-.]
 1480 1 +           [,-.]
 1490 1 -.]         [,-.]
 1501 1 2           [\1-\3]
 1511 1 3           [\1-\3]
 1520 1 4           [\1-\3]
 1531 1 \           [[-\]]
 1541 1 [           [[-\]]
 1551 1 ]           [[-\]]
 1560 1 -           [[-\]]
 157
 158# Test recursion and the abort code (use "wildtest -i" to see iteration counts)
 1591 1 -adobe-courier-bold-o-normal--12-120-75-75-m-70-iso8859-1   -*-*-*-*-*-*-12-*-*-*-m-*-*-*
 1600 1 -adobe-courier-bold-o-normal--12-120-75-75-X-70-iso8859-1   -*-*-*-*-*-*-12-*-*-*-m-*-*-*
 1610 1 -adobe-courier-bold-o-normal--12-120-75-75-/-70-iso8859-1   -*-*-*-*-*-*-12-*-*-*-m-*-*-*
 1621 1 /adobe/courier/bold/o/normal//12/120/75/75/m/70/iso8859/1   /*/*/*/*/*/*/12/*/*/*/m/*/*/*
 1630 1 /adobe/courier/bold/o/normal//12/120/75/75/X/70/iso8859/1   /*/*/*/*/*/*/12/*/*/*/m/*/*/*
 1641 1 abcd/abcdefg/abcdefghijk/abcdefghijklmnop.txt               **/*a*b*g*n*t
 1650 1 abcd/abcdefg/abcdefghijk/abcdefghijklmnop.txtz              **/*a*b*g*n*t