about summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2023-05-13 00:53:32 +0200
committerOliver Kiddle <opk@zsh.org>2023-05-13 00:53:32 +0200
commitb62e911341c8ec7446378b477c47da4256053dc0 (patch)
treebc617af736e29fd17f58cde409c18a2cb52f5501 /Test
parent9b9f3adde89e18945cf4e9029c500615d5092d87 (diff)
downloadzsh-b62e911341c8ec7446378b477c47da4256053dc0.tar.gz
zsh-b62e911341c8ec7446378b477c47da4256053dc0.tar.xz
zsh-b62e911341c8ec7446378b477c47da4256053dc0.zip
51723: migrate pcre module to pcre2
Diffstat (limited to 'Test')
-rw-r--r--Test/V07pcre.ztst13
1 files changed, 11 insertions, 2 deletions
diff --git a/Test/V07pcre.ztst b/Test/V07pcre.ztst
index 22a0b64c7..6eb366964 100644
--- a/Test/V07pcre.ztst
+++ b/Test/V07pcre.ztst
@@ -117,12 +117,17 @@
 >78884; ZPCRE_OP: 25 30
 >90210; ZPCRE_OP: 31 36
 
-# Embedded NULs allowed in plaintext, but not in RE (although \0 as two-chars allowed)
+# Embedded NULs allowed in plaintext, in RE, pcre supports \0 as two-chars
   [[ $'a\0bc\0d' =~ '^(a\0.)(.+)$' ]]
   print "${#MATCH}; ${#match[1]}; ${#match[2]}"
 0:ensure ASCII NUL passes in and out of matched plaintext
 >6; 3; 3
 
+# PCRE2 supports NULs also in the RE
+  [[ $'a\0b\0c' =~ $'^(.\0)+' ]] && print "${#MATCH}; ${#match[1]}"
+0:ensure ASCII NUL works also in the regex
+>4; 2
+
 # Ensure the long-form infix operator works
   [[ foo -pcre-match ^f..$ ]]
   print $?
@@ -169,7 +174,11 @@
   [[ é =~ '^..\z' ]]; echo $?
   LANG=$LANG_SAVE
   [[ é =~ '^.\z' ]]; echo $?
-0:swich between C/UTF-8 locales
+0:switch between C/UTF-8 locales
 >0
 >0
 >0
+
+  [[ abc =~ 'a(d*)bc' ]] && print "$#MATCH; $#match; ${#match[1]}"
+0:empty capture
+>3; 1; 0