diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2002-04-06 16:07:03 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-04-06 16:07:03 +0000 |
commit | 2393f1b901d4e694bd945211b6a0392db1b3cf57 (patch) | |
tree | a4e70557d6703ed1aed4c47201fe5b61a9232c93 /lib/Hash | |
parent | 19692e8d256164f96817d6df6ecee26c3cda4ae9 (diff) | |
download | perl-2393f1b901d4e694bd945211b6a0392db1b3cf57.tar.gz |
Make hv_notallowed a static as suggested by Nicholas Clark;
and synchronize the nomenclature to talk about restricted
(not fixed) hashes.
p4raw-id: //depot/perl@15758
Diffstat (limited to 'lib/Hash')
-rw-r--r-- | lib/Hash/Util.t | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/Hash/Util.t b/lib/Hash/Util.t index 0fe3128172..1046e32c54 100644 --- a/lib/Hash/Util.t +++ b/lib/Hash/Util.t @@ -23,7 +23,7 @@ foreach my $func (@Exported_Funcs) { my %hash = (foo => 42, bar => 23, locked => 'yep'); lock_keys(%hash); eval { $hash{baz} = 99; }; -like( $@, qr/^Attempt to access disallowed key 'baz' in a fixed hash/, +like( $@, qr/^Attempt to access disallowed key 'baz' in a restricted hash/, 'lock_keys()'); is( $hash{bar}, 23 ); ok( !exists $hash{baz} ); @@ -34,18 +34,18 @@ $hash{bar} = 69; is( $hash{bar}, 69 ); eval { () = $hash{i_dont_exist} }; -like( $@, qr/^Attempt to access disallowed key 'i_dont_exist' in a fixed hash/ ); +like( $@, qr/^Attempt to access disallowed key 'i_dont_exist' in a restricted hash/ ); lock_value(%hash, 'locked'); eval { print "# oops" if $hash{four} }; -like( $@, qr/^Attempt to access disallowed key 'four' in a fixed hash/ ); +like( $@, qr/^Attempt to access disallowed key 'four' in a restricted hash/ ); eval { $hash{"\x{2323}"} = 3 }; -like( $@, qr/^Attempt to access disallowed key '(.*)' in a fixed hash/, +like( $@, qr/^Attempt to access disallowed key '(.*)' in a restricted hash/, 'wide hex key' ); eval { delete $hash{locked} }; -like( $@, qr/^Attempt to delete readonly key 'locked' from a fixed hash/, +like( $@, qr/^Attempt to delete readonly key 'locked' from a restricted hash/, 'trying to delete a locked key' ); eval { $hash{locked} = 42; }; like( $@, qr/^Modification of a read-only value attempted/, @@ -53,7 +53,7 @@ like( $@, qr/^Modification of a read-only value attempted/, is( $hash{locked}, 'yep' ); eval { delete $hash{I_dont_exist} }; -like( $@, qr/^Attempt to delete disallowed key 'I_dont_exist' from a fixed hash/, +like( $@, qr/^Attempt to delete disallowed key 'I_dont_exist' from a restricted hash/, 'trying to delete a key that doesnt exist' ); ok( !exists $hash{I_dont_exist} ); @@ -81,7 +81,7 @@ TODO: { lock_keys(%hash); lock_value(%hash, 'locked'); eval { %hash = ( wubble => 42 ) }; # we know this will bomb - like( $@, qr/^Attempt to clear a fixed hash/ ); + like( $@, qr/^Attempt to clear a restricted hash/ ); eval { unlock_value(%hash, 'locked') }; # but this shouldn't is( $@, '', 'unlock_value() after denied assignment' ); @@ -97,7 +97,7 @@ TODO: { lock_value(%hash, 'RO'); eval { %hash = (KEY => 1) }; - like( $@, qr/^Attempt to clear a fixed hash/ ); + like( $@, qr/^Attempt to clear a restricted hash/ ); } # TODO: This should be allowed but it might require putting extra @@ -106,7 +106,7 @@ TODO: { my %hash = (KEY => 1, RO => 2); lock_keys(%hash); eval { %hash = (KEY => 1, RO => 2) }; - like( $@, qr/^Attempt to clear a fixed hash/ ); + like( $@, qr/^Attempt to clear a restricted hash/ ); } @@ -118,7 +118,7 @@ TODO: { $hash{foo} = 42; is( keys %hash, 1 ); eval { $hash{wibble} = 42 }; - like( $@, qr/^Attempt to access disallowed key 'wibble' in a fixed hash/, + like( $@, qr/^Attempt to access disallowed key 'wibble' in a restricted hash/, ' locked'); unlock_keys(%hash); @@ -137,7 +137,7 @@ TODO: { is( $@, '' ); eval { $hash{wibble} = 23 }; - like( $@, qr/^Attempt to access disallowed key 'wibble' in a fixed hash/, ' locked' ); + like( $@, qr/^Attempt to access disallowed key 'wibble' in a restricted hash/, ' locked' ); } @@ -167,4 +167,4 @@ TODO: { lock_keys(%ENV); eval { () = $ENV{I_DONT_EXIST} }; -like( $@, qr/^Attempt to access disallowed key 'I_DONT_EXIST' in a fixed hash/, 'locked %ENV'); +like( $@, qr/^Attempt to access disallowed key 'I_DONT_EXIST' in a restricted hash/, 'locked %ENV'); |