diff options
Diffstat (limited to 'Test/C02cond.ztst')
-rw-r--r-- | Test/C02cond.ztst | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Test/C02cond.ztst b/Test/C02cond.ztst index de82dcbe2..b0e278f4b 100644 --- a/Test/C02cond.ztst +++ b/Test/C02cond.ztst @@ -251,6 +251,39 @@ F:Failures in these cases do not indicate a problem in the shell. fi 0:regex tests shouldn't crash + if zmodload -i zsh/regex 2>/dev/null; then + string="this has stuff in it" + bad_regex=0 + if [[ $string =~ "h([a-z]*) s([a-z]*) " ]]; then + if [[ "$MATCH $MBEGIN $MEND" != "has stuff 6 15" ]]; then + print -r "regex variables MATCH MBEGIN MEND: + '$MATCH $MBEGIN $MEND' + should be: + 'has stuff 6 15'" >&2 + bad_regex=1 + else + results=("as 7 8" "tuff 11 14") + for i in 1 2; do + if [[ "$match[$i] $mbegin[$i] $mend[$i]" != $results[i] ]]; then + print -r "regex variables match[$i] mbegin[$i] mend[$i]: + '$match[$i] $mbegin[$i] $mend[$i]' + should be + '$results[$i]'" >&2 + break + fi + done + fi + else + print -r "regex failed to match '$string'" >&2 + fi + (( bad_regex )) || print OK + else + # if it didn't load, tough, but not a test error + print OK + fi +0:MATCH, MBEGIN, MEND, match, mbegin, mend +>OK + %clean # This works around a bug in rm -f in some versions of Cygwin chmod 644 unmodish |