summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Peters <steve@fisharerojo.org>2006-02-21 15:18:58 +0000
committerSteve Peters <steve@fisharerojo.org>2006-02-21 15:18:58 +0000
commit1b888f13a7247796f98d05df85e46b935fd0b8ba (patch)
treef7fc24e05f4928b3bf891cdffcc6050f190531cb
parent743b448f857ced95665ca43324e7007186d6d89c (diff)
downloadperl-1b888f13a7247796f98d05df85e46b935fd0b8ba.tar.gz
Add tests for the previously untested Hash::Util::all_keys().
p4raw-id: //depot/perl@27257
-rw-r--r--ext/Hash/Util/t/Util.t20
1 files changed, 19 insertions, 1 deletions
diff --git a/ext/Hash/Util/t/Util.t b/ext/Hash/Util/t/Util.t
index c8b36ee5e4..81e3e325cf 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");
+}
+