diff options
author | Hugo van der Sanden <hv@crypt.org> | 2021-02-03 13:01:57 +0000 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2021-02-09 08:42:52 -0800 |
commit | 3c7beb8da4692313468432f7e66606e56360d79c (patch) | |
tree | fa77c12adbea420d63260aa84760e713cd520440 /t | |
parent | 7127153a0aa372b27a6d28ba8fbbd332ec8e0eab (diff) | |
download | perl-3c7beb8da4692313468432f7e66606e56360d79c.tar.gz |
gh18515: tests for special-cased patterns
Diffstat (limited to 't')
-rw-r--r-- | t/op/split.t | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/t/op/split.t b/t/op/split.t index 7a321645ac..9a967adb19 100644 --- a/t/op/split.t +++ b/t/op/split.t @@ -7,7 +7,7 @@ BEGIN { require './charset_tools.pl'; } -plan tests => 193; +plan tests => 197; $FS = ':'; @@ -708,3 +708,20 @@ fresh_perl_is('our @ary; @ary = split(/\w(?{ *ary = 0 })/, "abc");', '',{},'(@ary = split ...) survives @ary destruction via typeglob'); fresh_perl_is('my $ary = []; @$ary = split(/\w(?{ $ary = [] })/, "abc");', '',{},'(@ary = split ...) survives @ary destruction via reassignment'); + +# gh18515: check that we spot and flag specific regexps for special treatment +SKIP: { + skip_if_miniperl("special-case patterns: need dynamic loading", 4); + for ([ q{" "}, 'WHITE' ], + [ q{/\\s+/}, 'WHITE' ], + [ q{/^/}, 'START_ONLY' ], + [ q{//}, 'NULL' ], + ) { + my($pattern, $flag) = @$_; + my $prog = "split $pattern"; + my $expect = qr{^r->extflags:.*\b$flag\b}m; + fresh_perl_like($prog, $expect, { + switches => [ '-Mre=Debug,COMPILE', '-c' ], + }, "special-case pattern for $prog"); + } +} |