From: Steve Peters Date: Tue, 21 Feb 2006 15:18:58 +0000 (+0000) Subject: Add tests for the previously untested Hash::Util::all_keys(). X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1b888f13a7247796f98d05df85e46b935fd0b8ba;p=p5sagit%2Fp5-mst-13.2.git Add tests for the previously untested Hash::Util::all_keys(). p4raw-id: //depot/perl@27257 --- diff --git a/ext/Hash/Util/t/Util.t b/ext/Hash/Util/t/Util.t index c8b36ee..81e3e32 100644 --- a/ext/Hash/Util/t/Util.t +++ b/ext/Hash/Util/t/Util.t @@ -33,7 +33,7 @@ BEGIN { hv_store ); - plan tests => 201 + @Exported_Funcs; + plan tests => 204 + @Exported_Funcs; use_ok 'Hash::Util', @Exported_Funcs; } foreach my $func (@Exported_Funcs) { @@ -452,3 +452,21 @@ ok($hash_seed >= 0, "hash_seed $hash_seed"); is("@legal","0 2 4 6 8 a b c d e f",'lock_keys_plus() @legal DDS/t 3'); is("@keys","0 2 4 6 8",'lock_keys_plus() @keys DDS/t 3'); } + +{ + my %hash = ('a'..'f'); + my @keys = (); + my @ph = (); + my @lock = ('a', 'c', 'e', 'g'); + lock_keys(%hash, @lock); + my $ref = all_keys(%hash, @keys, @ph); + my @crrack = sort(@keys); + my @ooooff = qw(a c e); + my @bam = qw(g); + + ok(ref $ref eq ref \%hash && $ref == \%hash, + "all_keys() - \$ref is a reference to \%hash"); + is_deeply(\@crrack, \@ooooff, "Keys are what they should be"); + is_deeply(\@ph, \@bam, "Placeholders in place"); +} +