From 316ee97c621496b0fe3267f57cce81bee44ca1e6 Mon Sep 17 00:00:00 2001 From: Siep Kroonenberg Date: Thu, 17 Feb 2011 12:20:49 +0000 Subject: Moving old tlperl prior to committing new one git-svn-id: svn://tug.org/texlive/trunk@21422 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/tlperl0/lib/Test/Deep/HashKeys.pm | 68 ++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100755 Master/tlpkg/tlperl0/lib/Test/Deep/HashKeys.pm (limited to 'Master/tlpkg/tlperl0/lib/Test/Deep/HashKeys.pm') 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; -- cgit v1.2.3