summaryrefslogtreecommitdiff
path: root/t/op
diff options
context:
space:
mode:
Diffstat (limited to 't/op')
-rwxr-xr-xt/op/magic.t2
-rwxr-xr-xt/op/ref.t12
-rwxr-xr-xt/op/substr.t13
3 files changed, 24 insertions, 3 deletions
diff --git a/t/op/magic.t b/t/op/magic.t
index dda07dfbc9..1c02b5bbad 100755
--- a/t/op/magic.t
+++ b/t/op/magic.t
@@ -349,7 +349,7 @@ else {
}
if ($Is_miniperl) {
- skip ("miniperl can't rely on loading %Errno");
+ skip ("miniperl can't rely on loading %Errno") for 1..2;
} else {
no warnings 'void';
diff --git a/t/op/ref.t b/t/op/ref.t
index 3bb280c1ea..597e03698c 100755
--- a/t/op/ref.t
+++ b/t/op/ref.t
@@ -5,7 +5,7 @@ BEGIN {
@INC = qw(. ../lib);
}
-print "1..68\n";
+print "1..69\n";
require 'test.pl';
@@ -357,6 +357,16 @@ runperl(prog => 'sub f { my $x = shift; *z = $x; } f({}); f();');
if ($? != 0) { print "not " };
print "ok ",++$test," - coredump on typeglob = (SvRV && !SvROK)\n";
+# bug #27268: freeing self-referential typeglobs could trigger
+# "Attempt to free unreferenced scalar" warnings
+
+$result = runperl(
+ prog => 'use Symbol;my $x=bless \gensym,"t"; print;*$$x=$x',
+ stderr => 1
+);
+print "not " if length $result;
+print "ok ",++$test," - freeing self-referential typeglob\n";
+print "# got: $result\n" if length $result;
# test global destruction
diff --git a/t/op/substr.t b/t/op/substr.t
index dfb483aee5..4df6426388 100755
--- a/t/op/substr.t
+++ b/t/op/substr.t
@@ -1,6 +1,6 @@
#!./perl
-print "1..177\n";
+print "1..179\n";
#P = start of string Q = start of substr R = end of substr S = end of string
@@ -609,3 +609,14 @@ ok 174, $x eq "\x{100}\x{200}\xFFb";
my $y = substr $x, 4;
ok 177, substr($x, 7, 1) eq "7";
}
+
+# [perl #24200] string corruption with lvalue sub
+
+{
+ my $foo = "a";
+ sub bar: lvalue { substr $foo, 0 }
+ bar = "XXX";
+ ok 178, bar eq 'XXX';
+ $foo = '123456789';
+ ok 179, bar eq '123456789';
+}