summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2001-12-18 15:55:22 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2001-12-18 15:55:22 +0000
commit8aacddc1ea3837f8f1a911d90c644451fc7cfc86 (patch)
tree6fd7ff4a46f0cbed519fe92c6244f38388482172 /t
parent7b5d8bbce1bc254559797266031a88531cfece6b (diff)
downloadperl-8aacddc1ea3837f8f1a911d90c644451fc7cfc86.tar.gz
Tidied version of Jeffrey Friedl's <jfriedl@yahoo.com> restricted hashes
- added delete of READONLY value inhibit & test for same - re-tabbed p4raw-id: //depot/perlio@13760
Diffstat (limited to 't')
-rw-r--r--t/lib/access.t17
1 files changed, 14 insertions, 3 deletions
diff --git a/t/lib/access.t b/t/lib/access.t
index b82b3e9271..815808c387 100644
--- a/t/lib/access.t
+++ b/t/lib/access.t
@@ -6,7 +6,7 @@ BEGIN {
}
$| = 1;
-print "1..15\n";
+print "1..19\n";
my $t = 1;
@@ -30,6 +30,8 @@ ok(!access::readonly(%hash));
ok(!access::readonly(%hash,1));
+ok(!access::readonly($hash{two},1));
+
eval { $hash{'three'} = 3 };
#warn "$@";
ok($@ =~ /^Attempt to access to key 'three' in fixed hash/);
@@ -43,11 +45,20 @@ eval { $hash{"\x{2323}"} = 3 };
ok($@ =~ /^Attempt to access to key '(.*)' in fixed hash/);
#ok(ord($1) == 0x2323);
+eval { delete $hash{'two'}};
+#warn "$@";
+ok($@);
+
eval { delete $hash{'one'}};
+ok(not $@);
+
+ok($hash{two} == 2);
+
+eval { delete $hash{'four'}};
#warn "$@";
-ok($@ =~ /^Attempt to access to key 'one' in fixed hash/);
+ok($@ =~ /^Attempt to access to key 'four' in fixed hash/);
-ok(exists $hash{'one'});
+ok(not exists $hash{'one'});
ok(!exists $hash{'three'});