diff options
Diffstat (limited to 'Test/V07pcre.ztst')
-rw-r--r-- | Test/V07pcre.ztst | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Test/V07pcre.ztst b/Test/V07pcre.ztst index 7426e7bf8..9feeb47fb 100644 --- a/Test/V07pcre.ztst +++ b/Test/V07pcre.ztst @@ -137,6 +137,39 @@ 0:ensure ASCII NUL passes in and out of matched plaintext >6; 3; 3 +# Ensure the long-form infix operator works + [[ foo -pcre-match ^f..$ ]] + print $? + [[ foo -pcre-match ^g..$ ]] + print $? + [[ ! foo -pcre-match ^g..$ ]] + print $? +0:infix -pcre-match works +>0 +>1 +>0 + +# Bash mode; note zsh documents that variables not updated on match failure, +# which remains different from bash + setopt bash_rematch + [[ "goo" -pcre-match ^f.+$ ]] ; print $? + [[ "foo" -pcre-match ^f.+$ ]] ; print -l $? _${^BASH_REMATCH[@]} + [[ "foot" -pcre-match ^f([aeiou]+)(.)$ ]]; print -l $? _${^BASH_REMATCH[@]} + [[ "foo" -pcre-match ^f.+$ ]] ; print -l $? _${^BASH_REMATCH[@]} + [[ ! "goo" -pcre-match ^f.+$ ]] ; print $? + unsetopt bash_rematch +0:bash-compatibility works +>1 +>0 +>_foo +>0 +>_foot +>_oo +>_t +>0 +>_foo +>0 + # Subshell because crash on failure ( setopt re_match_pcre [[ test.txt =~ '^(.*_)?(test)' ]] |