1 #!/usr/local/bin/zsh -f
3 setopt kshglob extendedglob
6 while read res str pat
; do
7 [[ $res = '#' ]] && continue
10 [[ $1 = -q ]] || print
"$ts: [[ $str = $pat ]]"
11 if [[ ( $ts -gt 0 && $res = t
) ||
($ts -eq 0 && $res = f
) ]]; then
12 print
"Test failed: [[ $str = $pat ]]"
20 t fooofoofofooo *(f*(o))
24 t ofxoofxo *(*(of*(o)x)o)
25 f ofooofoofofooo *(f*(o))
26 t foooxfooxfoxfooox *(f*(o)x)
27 f foooxfooxofoxfooox *(f*(o)x)
28 t foooxfooxfxfooox *(f*(o)x)
29 t ofxoofxo *(*(of*(o)x)o)
30 t ofoooxoofxo *(*(of*(o)x)o)
31 t ofoooxoofxoofoooxoofxo *(*(of*(o)x)o)
32 t ofoooxoofxoofoooxoofxoo *(*(of*(o)x)o)
33 f ofoooxoofxoofoooxoofxofo *(*(of*(o)x)o)
34 t ofoooxoofxoofoooxoofxooofxofxo *(*(of*(o)x)o)
41 t abcd @(ab|a*@(b))*(c)d
42 t acd @(ab|a*(b))*(c)d
43 t abbcd @(ab|a*(b))*(c)d
44 t effgz @(b+(c)d|e*(f)g?|?(h)i@(j|k))
45 t efgz @(b+(c)d|e*(f)g?|?(h)i@(j|k))
46 t egz @(b+(c)d|e*(f)g?|?(h)i@(j|k))
47 t egzefffgzbcdij *(b+(c)d|e*(f)g?|?(h)i@(j|k))
48 f egz @(b+(c)d|e+(f)g?|?(h)i@(j|k))
50 t oxfoxoxfox *(oxf+(ox))
51 f oxfoxfox *(oxf+(ox))
53 # The following is supposed to match only as fo+ofo+ofo
54 t foofoofo @(foo|f|fo)*(f|of+(o))
55 t oofooofo *(of|oof+(o))
56 t fffooofoooooffoofffooofff *(*(f)*(o))
57 # If the following is really slow, that's a bug.
58 f fffooofoooooffoofffooofffx *(*(f)*(o))
59 # The following tests backtracking in alternation matches
60 t fofoofoofofoo *(fo|foo)
68 t moo.cow !(*.*).!(*.*)
69 f mad.moo.cow !(*.*).!(*.*)
70 f mucca.pazza mu!(*(c))?.pa!(*(z))?
94 f fooxx (#i)FOO@(#I)X@(#i)X
95 t fooXx (#i)FOO@(#I)X@(#i)X
102 print
"$failed tests failed."