Add Scalar-List-Utils 1.02, from Graham Barr.
[p5sagit/p5-mst-13.2.git] / t / lib / u-readonly.t
1 BEGIN {
2         chdir 't' if -d 't';
3         @INC = '../lib';
4 }
5
6 use Scalar::Util qw(readonly);
7
8 print "1..9\n";
9
10 print "not " unless readonly(1);
11 print "ok 1\n";
12
13 my $var = 2;
14
15 print "not " if readonly($var);
16 print "ok 2\n";
17
18 print "not " unless $var == 2;
19 print "ok 3\n";
20
21 print "not " unless readonly("fred");
22 print "ok 4\n";
23
24 $var = "fred";
25
26 print "not " if readonly($var);
27 print "ok 5\n";
28
29 print "not " unless $var eq "fred";
30 print "ok 6\n";
31
32 $var = \2;
33
34 print "not " if readonly($var);
35 print "ok 7\n";
36
37 print "not " unless readonly($$var);
38 print "ok 8\n";
39
40 print "not " if readonly(*STDOUT);
41 print "ok 9\n";