diff options
author | Peter Stephenson <p.stephenson@samsung.com> | 2023-08-01 14:32:55 +0100 |
---|---|---|
committer | Peter Stephenson <p.stephenson@samsung.com> | 2023-08-01 14:32:55 +0100 |
commit | aa8e4a02904b3a1c4b3064eb7502d887f7de958b (patch) | |
tree | da94d9b9aa4aecc7b4573ea02f5b151d0802a05e /Test | |
parent | 95269147fcbd85961d652ab419bb168a8aafcd14 (diff) | |
download | zsh-aa8e4a02904b3a1c4b3064eb7502d887f7de958b.tar.gz zsh-aa8e4a02904b3a1c4b3064eb7502d887f7de958b.tar.xz zsh-aa8e4a02904b3a1c4b3064eb7502d887f7de958b.zip |
52008: Pattern bug with branches + exclusion
Add tests.
Diffstat (limited to 'Test')
-rw-r--r-- | Test/D02glob.ztst | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Test/D02glob.ztst b/Test/D02glob.ztst index 850a535e5..4d88e5c27 100644 --- a/Test/D02glob.ztst +++ b/Test/D02glob.ztst @@ -817,6 +817,32 @@ *>*/glob.tmp/(flip|flop) *>*/glob.tmp/(flip|flop)/trailing/components +# The following set test an obscure problem with branches followed by +# exclusions that shows up when the exclusion matches against +# something other than the complete test string, hence the complicated +# double negative. + [[ ab = (|a*)~^(*b) ]] +0:Regression test for exclusion after branches: empty first alternative + + [[ ab = (b|a*)~^(*b) ]] +0:Regression test for exclusion after branches: non-empty first alternative + + [[ ab = (b*|a*)~^(*b) ]] +0:Regression test for exclusion after branches: full length first alternative + +# Corresponding tests where the exclusion should succeed, so the +# match fails. It's hard to know how to provoke bugs here... + [[ abc = (|a*)~^(*b) ]] +1:Regression test for exclusion after branches: failure case 1 + + [[ abc = (b|a*)~^(*b) ]] +1:Regression test for exclusion after branches: failure case 2 + + [[ abc = (b*|a*)~^(*b) ]] +1:Regression test for exclusion after branches: failure case 3 + +# Careful: extendedglob off from this point. + unsetopt extendedglob print -r -- ${(*)=${(@s.+.):-A+B}/(#b)(?)/-${(L)match[1]} ${match[1]}} 0:the '*' qualfier enables extended_glob for pattern matching |