2 # More ksh-like extended globbing tests, cribbed from zsh-3.1.5
7 while read res str pat; do
8 [[ $res = '#' ]] && continue
11 [[ $1 = -q ]] || echo "$ts: [[ $str = $pat ]]"
12 if [[ ( $ts -gt 0 && $res = t) || ($ts -eq 0 && $res = f) ]]; then
13 echo "Test failed: [[ $str = $pat ]]"
21 t fooofoofofooo *(f*(o))
25 t ofxoofxo *(*(of*(o)x)o)
26 f ofooofoofofooo *(f*(o))
27 t foooxfooxfoxfooox *(f*(o)x)
28 f foooxfooxofoxfooox *(f*(o)x)
29 t foooxfooxfxfooox *(f*(o)x)
30 t ofxoofxo *(*(of*(o)x)o)
31 t ofoooxoofxo *(*(of*(o)x)o)
32 t ofoooxoofxoofoooxoofxo *(*(of*(o)x)o)
33 t ofoooxoofxoofoooxoofxoo *(*(of*(o)x)o)
34 f ofoooxoofxoofoooxoofxofo *(*(of*(o)x)o)
35 t ofoooxoofxoofoooxoofxooofxofxo *(*(of*(o)x)o)
42 t abcd @(ab|a*@(b))*(c)d
43 t acd @(ab|a*(b))*(c)d
44 t abbcd @(ab|a*(b))*(c)d
45 t effgz @(b+(c)d|e*(f)g?|?(h)i@(j|k))
46 t efgz @(b+(c)d|e*(f)g?|?(h)i@(j|k))
47 t egz @(b+(c)d|e*(f)g?|?(h)i@(j|k))
48 t egzefffgzbcdij *(b+(c)d|e*(f)g?|?(h)i@(j|k))
49 f egz @(b+(c)d|e+(f)g?|?(h)i@(j|k))
51 t oxfoxoxfox *(oxf+(ox))
52 f oxfoxfox *(oxf+(ox))
54 # The following is supposed to match only as fo+ofo+ofo
55 t foofoofo @(foo|f|fo)*(f|of+(o))
56 t oofooofo *(of|oof+(o))
57 t fffooofoooooffoofffooofff *(*(f)*(o))
58 # The following tests backtracking in alternation matches
59 t fofoofoofofoo *(fo|foo)
67 t moo.cow !(*.*).!(*.*)
68 f mad.moo.cow !(*.*).!(*.*)
69 f mucca.pazza mu!(*(c))?.pa!(*(z))?
90 echo "$failed tests failed."