This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
t/re/script_run.t: Tests for 'sr' form of (*script_run:...)
authorKarl Williamson <khw@cpan.org>
Tue, 20 Feb 2018 03:12:28 +0000 (20:12 -0700)
committerKarl Williamson <khw@cpan.org>
Tue, 20 Feb 2018 03:47:10 +0000 (20:47 -0700)
t/re/script_run.t

index 8c91602..622ff15 100644 (file)
@@ -17,7 +17,11 @@ $|=1;
 
 no warnings "experimental::script_run";
 
-my $script_run = qr/ ^ (*script_run: .* ) $ /x;
+# Since there's so few tests currently, we can afford to try each syntax on
+# all of them
+foreach my $type ('script_run', 'sr') {
+    my $script_run;
+    eval '$script_run = qr/ ^ (*$type: .* ) $ /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");
@@ -80,5 +84,6 @@ use utf8;
 
 # From UTS 39
 like("写真だけの結婚式", $script_run, "Mixed Hiragana and Han");
+}
 
 done_testing();