#!./perl -T
BEGIN {
chdir
't'
if
-d
't'
;
@INC
= (
'../lib'
);
require
Config;
import
Config;
require
'./test.pl'
;
skip_all_if_miniperl(
"No Scalar::Util under miniperl"
);
if
(
exists
(
$Config
{taint_support}) && !
$Config
{taint_support}) {
skip_all(
"built without taint support"
);
}
}
$| = 1;
plan
tests
=> 4;
watchdog(60);
my
$taint
=
substr
(
$ENV
{PATH}, 0, 0);
{
my
$in
=
$taint
. (
"ab"
x 200_000 );
utf8::upgrade(
$in
);
ok(tainted(
$in
),
"performance issue only when tainted"
);
while
(
$in
=~ /\Ga+b/g) { }
pass(
"\\G on tainted string"
);
}
{
my
$repeat
= 30_000;
my
$in
=
$taint
. (
"abcdefghijklmnopqrstuvwxyz"
x
$repeat
);
utf8::upgrade(
$in
);
ok(tainted(
$in
),
"performance issue only when tainted"
);
local
${^UTF8CACHE} = 1;
for
my
$i
(1..
$repeat
) {
$in
=~ /abcdefghijklmnopqrstuvwxyz/g or
die
;
my
$p
=
pos
(
$in
);
}
pass(
"RT #130584 pos on tainted utf8 string"
);
}
1;