chdir 't' if -d 't';
@INC = '../lib';
require './test.pl';
- plan( tests => 13 );
+ plan( tests => 16 );
}
for my $arg ('', 'q[]', qw( 1 undef )) {
- fresh_perl_is(<<"----", <<'====', "Internals::* functions check their argument under func() AND &func() [perl #77776]");
+ fresh_perl_is(<<"----", <<'====', {}, "Internals::* functions check their argument under func() AND &func() [perl #77776]");
sub tryit { eval shift or warn \$@ }
tryit "&Internals::SvREADONLY($arg)";
tryit "&Internals::SvREFCNT($arg)";
$h{b} =~ y/ia/ao/;
is __PACKAGE__, 'main',
'turning off a cow’s readonliness did not affect sharers of the same PV';
+
+&Internals::SvREADONLY(\!0, 0);
+eval { ${\!0} = 7 };
+like $@, qr "^Modification of a read-only value",
+ 'protected values still croak on assignment after SvREADONLY(..., 0)';
+is ${\3} == 3, "1", 'attempt to modify failed';
+
+eval { { my $x = ${qr//}; Internals::SvREADONLY $x, 1; () } };
+is $@, "", 'read-only lexical regexps on scope exit [perl #115254]';