A new regression test from:
authorPaul Marquess <paul.marquess@btinternet.com>
Sun, 29 Oct 2006 21:03:21 +0000 (21:03 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Mon, 13 Nov 2006 14:15:33 +0000 (14:15 +0000)
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

ext/List/Util/t/readonly.t

index a515f2e..7415759 100644 (file)
@@ -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');
+