summaryrefslogtreecommitdiff
path: root/ext/List
diff options
context:
space:
mode:
authorPaul Marquess <paul.marquess@btinternet.com>2006-10-29 21:03:21 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-11-13 14:15:33 +0000
commit19d9c0e45bf900f576aa43d944ccfe4aebd3f678 (patch)
tree246cbea254d82848ef6772c6cd1ca5203867e3b1 /ext/List
parent5d458dd8ef53373c3f90d568f6668084b0ccbc62 (diff)
downloadperl-19d9c0e45bf900f576aa43d944ccfe4aebd3f678.tar.gz
A new regression test from:
Subject: [PATHCH] Scalar::Util::readonly & compression (was RE: Change 29117: [PATCH] IO::Compress modules) From: "Paul Marquess" <paul.marquess@ntlworld.com> Message-ID: <02cf01c6fb9d$ade808a0$6501a8c0@myopwv.com> p4raw-id: //depot/perl@29261
Diffstat (limited to 'ext/List')
-rw-r--r--ext/List/Util/t/readonly.t13
1 files changed, 12 insertions, 1 deletions
diff --git a/ext/List/Util/t/readonly.t b/ext/List/Util/t/readonly.t
index a515f2e3f3..7415759010 100644
--- a/ext/List/Util/t/readonly.t
+++ b/ext/List/Util/t/readonly.t
@@ -14,7 +14,7 @@ BEGIN {
}
use Scalar::Util qw(readonly);
-use Test::More tests => 9;
+use Test::More tests => 11;
ok( readonly(1), 'number constant');
@@ -36,3 +36,14 @@ ok( !readonly($var), 'reference to constant');
ok( readonly($$var), 'de-reference to constant');
ok( !readonly(*STDOUT), 'glob');
+
+sub try
+{
+ my $v = \$_[0];
+ return readonly $$v;
+}
+
+$var = 123;
+ok( try ("abc"), 'reference a constant in a sub');
+ok( !try ($var), 'reference a non-constant in a sub');
+