This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
An empty string is a script_run, but marked INVALID
authorKarl Williamson <khw@cpan.org>
Tue, 9 Jan 2018 02:11:52 +0000 (19:11 -0700)
committerKarl Williamson <khw@cpan.org>
Wed, 31 Jan 2018 05:12:46 +0000 (22:12 -0700)
regexec.c
t/re/script_run.t

index d11feab..ae37c18 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -10360,7 +10360,7 @@ Perl_isSCRIPT_RUN(pTHX_ const U8 * s, const U8 * send, const bool utf8_target, S
 
     bool retval = TRUE;
 
-    assert(send > s);
+    assert(send >= s);
 
     PERL_ARGS_ASSERT_ISSCRIPT_RUN;
 
index f7b0897..4878f39 100644 (file)
@@ -17,7 +17,7 @@ $|=1;
 
 no warnings "experimental::script_run";
 
-my $script_run = qr/ ^ (+script_run: .+ ) $ /x;
+my $script_run = qr/ ^ (+script_run: .* ) $ /x;
 
 unlike("\N{CYRILLIC SMALL LETTER ER}\N{CYRILLIC SMALL LETTER A}\N{CYRILLIC SMALL LETTER U}}\N{CYRILLIC SMALL LETTER ER}\N{CYRILLIC SMALL LETTER A}l", $script_run, "Cyrillic 'paypal' with a Latin 'l' is not a script run");
 unlike("A\N{GREEK CAPITAL LETTER GAMMA}", $script_run, "Latin followed by Greek isn't a script run");
@@ -74,6 +74,8 @@ like("\N{DEVANAGARI DOUBLE DANDA}\N{DEVANAGARI DANDA}\N{DEVANAGARI STRESS SIGN U
 unlike("\N{JAVANESE PANGRANGKEP}\N{GEORGIAN PARAGRAPH SEPARATOR}", $script_run, "Two code points each in multiple scripts that don't intersect aren't a script run");
 like("\N{DEVANAGARI SIGN CANDRABINDU VIRAMA}\N{VEDIC TONE YAJURVEDIC KATHAKA INDEPENDENT SVARITA}", $script_run, "Two code points each in multiple scripts that 't intersect singly are a script run");
 
+like("", $script_run, "An empty string is a script run");
+
 use utf8;
 
 # From UTS 39