Commit | Line | Data |
f4a2945e |
1 | BEGIN { |
2 | chdir 't' if -d 't'; |
3 | @INC = '../lib'; |
6b05f64e |
4 | require Config; import Config; |
5 | if ($Config{extensions} !~ /\bList\/Util\b/) { |
6 | print "1..0 # Skip: List::Util was not built\n"; |
7 | exit 0; |
8 | } |
f4a2945e |
9 | } |
10 | |
11 | use Scalar::Util qw(readonly); |
12 | |
13 | print "1..9\n"; |
14 | |
15 | print "not " unless readonly(1); |
16 | print "ok 1\n"; |
17 | |
18 | my $var = 2; |
19 | |
20 | print "not " if readonly($var); |
21 | print "ok 2\n"; |
22 | |
23 | print "not " unless $var == 2; |
24 | print "ok 3\n"; |
25 | |
26 | print "not " unless readonly("fred"); |
27 | print "ok 4\n"; |
28 | |
29 | $var = "fred"; |
30 | |
31 | print "not " if readonly($var); |
32 | print "ok 5\n"; |
33 | |
34 | print "not " unless $var eq "fred"; |
35 | print "ok 6\n"; |
36 | |
37 | $var = \2; |
38 | |
39 | print "not " if readonly($var); |
40 | print "ok 7\n"; |
41 | |
42 | print "not " unless readonly($$var); |
43 | print "ok 8\n"; |
44 | |
45 | print "not " if readonly(*STDOUT); |
46 | print "ok 9\n"; |