line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CHI::Test::Driver::Role::CheckKeyValidity; |
2
|
|
|
|
|
|
|
$CHI::Test::Driver::Role::CheckKeyValidity::VERSION = '0.61'; |
3
|
3
|
|
|
3
|
|
24
|
use Carp; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
243
|
|
4
|
3
|
|
|
3
|
|
21
|
use Moo::Role; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
33
|
|
5
|
3
|
|
|
3
|
|
1283
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
71
|
|
6
|
3
|
|
|
3
|
|
17
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
612
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has 'test_object' => ( is => 'rw' ); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
before 'get' => sub { |
11
|
|
|
|
|
|
|
my ( $self, $key ) = @_; |
12
|
|
|
|
|
|
|
$self->verify_valid_test_key($key); |
13
|
|
|
|
|
|
|
}; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
before 'set' => sub { |
16
|
|
|
|
|
|
|
my ( $self, $key ) = @_; |
17
|
|
|
|
|
|
|
$self->verify_valid_test_key($key); |
18
|
|
|
|
|
|
|
}; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub verify_valid_test_key { |
21
|
3237
|
|
|
3237
|
0
|
5688
|
my ( $self, $key ) = @_; |
22
|
|
|
|
|
|
|
croak "invalid test key '$key'" |
23
|
|
|
|
|
|
|
if ( defined($key) |
24
|
3237
|
50
|
66
|
|
|
71519
|
&& !exists( $self->test_object->{all_test_keys_hash}->{$key} ) ); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |