1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-06-01 04:46:08 +02:00

28338: keep =~ from inverting sense of subsequent tests (after &&/||)

This commit is contained in:
pdpennock 2010-10-10 00:05:24 +00:00
parent f58f9caf6f
commit d234059b1c
2 changed files with 15 additions and 1 deletions

View File

@ -2172,10 +2172,11 @@ par_cond_triple(char *a, char *b, char *c)
ecadd(ecnpats++);
} else if ((b[0] == Equals || b[0] == '=') &&
(b[1] == '~' || b[1] == Tilde) && !b[2]) {
/* We become an implicit COND_MODI but do not provide the first
* item, it's skipped */
ecadd(WCB_COND(COND_REGEX, 0));
ecstr(a);
ecstr(c);
ecadd(ecnpats++);
} else if (b[0] == '-') {
if ((t0 = get_cond_num(b + 1)) > -1) {
ecadd(WCB_COND(t0 + COND_NT, 0));

View File

@ -283,6 +283,19 @@ F:Failures in these cases do not indicate a problem in the shell.
print OK
fi)
0:MATCH, MBEGIN, MEND, match, mbegin, mend
>OK
(if zmodload -i zsh/regex 2>/dev/null; then
if [[ a =~ a && b == b ]]; then
print OK
else
print "regex =~ inverted following test"
fi
else
# not a test error
print OK
fi)
0:regex infix operator should not invert following conditions
>OK
[[ -fail badly ]]