summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-01-22 22:39:47 -0800
committerFather Chrysostomos <sprout@cpan.org>2012-01-22 22:39:47 -0800
commit3a482d8d6250628185cb4de79a85f353ba799a58 (patch)
tree73f23180f51545b880bec52716c162ea7cd9f7c1 /t
parent1ef8987b48398aed58d54d2cf83033cbbb7f3d7f (diff)
downloadperl-3a482d8d6250628185cb4de79a85f353ba799a58.tar.gz
sv_force_normal: Don’t confuse regexps with cows
Otherwise we get assertion failures and possibly corrupt string tables.
Diffstat (limited to 't')
-rw-r--r--t/lib/universal.t14
1 files changed, 13 insertions, 1 deletions
diff --git a/t/lib/universal.t b/t/lib/universal.t
index 1576470ef8..a52e01972f 100644
--- a/t/lib/universal.t
+++ b/t/lib/universal.t
@@ -6,7 +6,7 @@ BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
require './test.pl';
- plan( tests => 10 );
+ plan( tests => 13 );
}
for my $arg ('', 'q[]', qw( 1 undef )) {
@@ -37,6 +37,18 @@ Internals::SvREADONLY($x,0);
$x = 42;
is $x, 42, 'Internals::SvREADONLY can turn off readonliness on globs';
+# Same thing with regexps
+$x = ${qr//};
+Internals::SvREADONLY $x, 1;
+ok Internals::SvREADONLY($x),
+ 'read-only regexps are read-only acc. to Internals::';
+eval { $x = [] };
+like $@, qr/Modification of a read-only value attempted at/,
+ 'read-only regexps';
+Internals::SvREADONLY($x,0);
+$x = 42;
+is $x, 42, 'Internals::SvREADONLY can turn off readonliness on regexps';
+
$h{a} = __PACKAGE__;
Internals::SvREADONLY $h{a}, 1;
eval { $h{a} = 3 };