22 my ($pack,$file,$line) = caller;
23 print "not ok $t # $file:$line\n";
28 my %hash = ( one => 1, two => 2);;
29 ok(!access::readonly(%hash));
31 ok(!access::readonly(%hash,1));
33 ok(!access::readonly($hash{two},1));
35 eval { $hash{'three'} = 3 };
37 ok($@ =~ /^Attempt to access to key 'three' in fixed hash/);
39 eval { print "# oops" if $hash{'four'}};
41 ok($@ =~ /^Attempt to access to key 'four' in fixed hash/);
43 eval { $hash{"\x{2323}"} = 3 };
45 ok($@ =~ /^Attempt to access to key '(.*)' in fixed hash/);
46 #ok(ord($1) == 0x2323);
48 eval { delete $hash{'two'}};
52 eval { delete $hash{'one'}};
57 eval { delete $hash{'four'}};
59 ok($@ =~ /^Attempt to access to key 'four' in fixed hash/);
61 ok(not exists $hash{'one'});
63 ok(!exists $hash{'three'});
65 ok(access::readonly(%hash,0));
67 ok(!access::readonly(%hash));
70 ok(!access::readonly($scalar));
72 ok(!access::readonly($scalar,1));
76 ok($@ =~ /^Modification of a read-only value attempted/);
78 ok(access::readonly($scalar,0));
80 ok(!access::readonly($scalar));