root/branches/release-40/t/lib/Test/Deep/HashKeys.pm @ 2583

Revision 2583, 1.0 kB (checked in by mpaschal, 18 months ago)

Add Test::Deep to t/lib, since we already use it in driver-tests.pl
BugzID: 79953

Line 
1use strict;
2use warnings;
3
4package Test::Deep::HashKeys;
5
6use Test::Deep::Ref;
7
8sub init
9{
10        my $self = shift;
11
12        my %keys;
13        @keys{@_} = ();
14        $self->{val} = \%keys;
15        $self->{keys} = [sort @_];
16}
17
18sub descend
19{
20        my $self = shift;
21        my $got = shift;
22
23        my $exp = $self->{val};
24
25        return 0 unless $self->test_reftype($got, "HASH");
26
27        return Test::Deep::descend($got, $self->hashkeysonly($exp));
28}
29
30sub hashkeysonly
31{
32        require Test::Deep::HashKeysOnly;
33
34        my $self = shift;
35        my $exp = shift;
36
37        return Test::Deep::HashKeysOnly->new(keys %$exp)
38}
39
40package Test::Deep::SuperHashKeys;
41
42use base 'Test::Deep::HashKeys';
43
44sub hashkeysonly
45{
46        require Test::Deep::HashKeysOnly;
47
48        my $self = shift;
49        my $exp = shift;
50
51        return Test::Deep::SuperHashKeysOnly->new(keys %$exp)
52}
53
54package Test::Deep::SubHashKeys;
55
56use base 'Test::Deep::HashKeys';
57
58sub hashkeysonly
59{
60        require Test::Deep::HashKeysOnly;
61
62        my $self = shift;
63        my $exp = shift;
64
65        return Test::Deep::SubHashKeysOnly->new(keys %$exp)
66}
67
681;
Note: See TracBrowser for help on using the browser.