In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/e426a4af0644ce718d70a7327657df22c8e68d9e?hp=f434f3571e41ee9c418f07c8510af58cf4083f70>

- Log -----------------------------------------------------------------
commit e426a4af0644ce718d70a7327657df22c8e68d9e
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Sat Sep 17 11:06:55 2016 -0700

    Add regexp_nonull.t
    
    for testing the regular expression engine with strings that
    lack a trailing null byte.
-----------------------------------------------------------------------

Summary of changes:
 MANIFEST                  |  1 +
 ext/XS-APItest/APItest.xs | 12 ++++++++++++
 t/re/regexp.t             |  4 +++-
 t/re/regexp_nonull.t      | 17 +++++++++++++++++
 4 files changed, 33 insertions(+), 1 deletion(-)
 create mode 100644 t/re/regexp_nonull.t

diff --git a/MANIFEST b/MANIFEST
index d99b41b..f37157f 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -5678,6 +5678,7 @@ t/re/regex_sets.t         Test (?[ ])
 t/re/regex_sets_compat.t       Test (?[ ]) is compatible with old [ ]
 t/re/regexp.t                  See if regular expressions work
 t/re/regexp_noamp.t            See if regular expressions work with 
optimizations
+t/re/regexp_nonull.t           See if regexps work without trailing nulls
 t/re/regexp_notrie.t           See if regular expressions work without trie 
optimisation
 t/re/regexp_qr.t               See if regular expressions work as qr//
 t/re/regexp_qr_embed.t         See if regular expressions work with embedded 
qr//
diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs
index 4602cee..907c17d 100644
--- a/ext/XS-APItest/APItest.xs
+++ b/ext/XS-APItest/APItest.xs
@@ -4219,6 +4219,18 @@ CODE:
     } else
         Perl_croak(aTHX_ "load_module can't yet support %"IVdf" items", 
(IV)items);
 
+SV *
+string_without_null(SV *sv)
+    CODE:
+    {
+        STRLEN len;
+        const char *s = SvPV(sv, len);
+        RETVAL = newSVpvn_flags(s, len, SvUTF8(sv));
+        *SvEND(RETVAL) = 0xff;
+    }
+    OUTPUT:
+        RETVAL
+
 MODULE = XS::APItest PACKAGE = XS::APItest::AUTOLOADtest
 
 int
diff --git a/t/re/regexp.t b/t/re/regexp.t
index 5ec6e5c..2cbfc9f 100644
--- a/t/re/regexp.t
+++ b/t/re/regexp.t
@@ -98,7 +98,8 @@ sub convert_from_ascii {
 use strict;
 use warnings FATAL=>"all";
 use vars qw($bang $ffff $nulnul); # used by the tests
-use vars qw($qr $skip_amp $qr_embed $qr_embed_thr $regex_sets); # set by our 
callers
+use vars qw($qr $skip_amp $qr_embed $qr_embed_thr $regex_sets
+            $no_null); # set by our callers
 
 
 
@@ -363,6 +364,7 @@ foreach (@tests) {
        # Need to make a copy, else the utf8::upgrade of an already studied
        # scalar confuses things.
        my $subject = $subject;
+       $subject = XS::APItest::string_without_null($subject) if $no_null;
        my $c = $iters;
        my ($code, $match, $got);
         if ($repl eq 'pos') {
diff --git a/t/re/regexp_nonull.t b/t/re/regexp_nonull.t
new file mode 100644
index 0000000..885ef0f
--- /dev/null
+++ b/t/re/regexp_nonull.t
@@ -0,0 +1,17 @@
+#!./perl
+
+# Matches regular expressions against strings with no terminating null
+# character.
+
+print("1..0 # Skip No XS::APItest under miniperl\n"), exit 0 if
+  !defined &DynaLoader::boot_DynaLoader;
+
+$no_null = 1;
+require XS::APItest;
+for $file ('./re/regexp.t', './t/re/regexp.t', ':re:regexp.t') {
+  if (-r $file) {
+    do $file or die $@;
+    exit;
+  }
+}
+die "Cannot find ./re/regexp.t or ./t/re/regexp.t\n";

--
Perl5 Master Repository

Reply via email to