summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl0/lib/Test/Deep/HashKeys.pm
diff options
context:
space:
mode:
authorSiep Kroonenberg <siepo@cybercomm.nl>2011-02-17 12:20:49 +0000
committerSiep Kroonenberg <siepo@cybercomm.nl>2011-02-17 12:20:49 +0000
commit316ee97c621496b0fe3267f57cce81bee44ca1e6 (patch)
treecb2cab1192b4f58a7971af19b213e980bceda4b4 /Master/tlpkg/tlperl0/lib/Test/Deep/HashKeys.pm
parentcd0f87b5d39480d85ad9bd4ee37f520f75bed560 (diff)
Moving old tlperl prior to committing new one
git-svn-id: svn://tug.org/texlive/trunk@21422 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlperl0/lib/Test/Deep/HashKeys.pm')
-rwxr-xr-xMaster/tlpkg/tlperl0/lib/Test/Deep/HashKeys.pm68
1 files changed, 68 insertions, 0 deletions
diff --git a/Master/tlpkg/tlperl0/lib/Test/Deep/HashKeys.pm b/Master/tlpkg/tlperl0/lib/Test/Deep/HashKeys.pm
new file mode 100755
index 00000000000..d0f6fc4afc6
--- /dev/null
+++ b/Master/tlpkg/tlperl0/lib/Test/Deep/HashKeys.pm
@@ -0,0 +1,68 @@
+use strict;
+use warnings;
+
+package Test::Deep::HashKeys;
+
+use Test::Deep::Ref;
+
+sub init
+{
+ my $self = shift;
+
+ my %keys;
+ @keys{@_} = ();
+ $self->{val} = \%keys;
+ $self->{keys} = [sort @_];
+}
+
+sub descend
+{
+ my $self = shift;
+ my $got = shift;
+
+ my $exp = $self->{val};
+
+ return 0 unless $self->test_reftype($got, "HASH");
+
+ return Test::Deep::descend($got, $self->hashkeysonly($exp));
+}
+
+sub hashkeysonly
+{
+ require Test::Deep::HashKeysOnly;
+
+ my $self = shift;
+ my $exp = shift;
+
+ return Test::Deep::HashKeysOnly->new(keys %$exp)
+}
+
+package Test::Deep::SuperHashKeys;
+
+use base 'Test::Deep::HashKeys';
+
+sub hashkeysonly
+{
+ require Test::Deep::HashKeysOnly;
+
+ my $self = shift;
+ my $exp = shift;
+
+ return Test::Deep::SuperHashKeysOnly->new(keys %$exp)
+}
+
+package Test::Deep::SubHashKeys;
+
+use base 'Test::Deep::HashKeys';
+
+sub hashkeysonly
+{
+ require Test::Deep::HashKeysOnly;
+
+ my $self = shift;
+ my $exp = shift;
+
+ return Test::Deep::SubHashKeysOnly->new(keys %$exp)
+}
+
+1;