line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CHI::t::Subcache; |
2
|
|
|
|
|
|
|
$CHI::t::Subcache::VERSION = '0.60'; |
3
|
1
|
|
|
1
|
|
578
|
use CHI::Test; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
4
|
1
|
|
|
1
|
|
6
|
use CHI::Util qw(can_load); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
39
|
|
5
|
1
|
|
|
1
|
|
7
|
use base qw(CHI::Test::Class); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
322
|
|
6
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
7
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
145
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub test_option_inheritance : Tests { |
10
|
1
|
|
|
1
|
0
|
2666
|
my $self = shift; |
11
|
|
|
|
|
|
|
|
12
|
1
|
50
|
|
|
|
5
|
return 'Data::Serializer not installed' |
13
|
|
|
|
|
|
|
unless can_load('Data::Serializer'); |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
0
|
my %params = ( |
16
|
|
|
|
|
|
|
expires_variance => 0.2, |
17
|
|
|
|
|
|
|
namespace => 'Blurg', |
18
|
|
|
|
|
|
|
on_get_error => 'warn', |
19
|
|
|
|
|
|
|
on_set_error => 'warn', |
20
|
|
|
|
|
|
|
serializer => 'Data::Dumper', |
21
|
|
|
|
|
|
|
depth => 4, |
22
|
|
|
|
|
|
|
); |
23
|
0
|
|
|
|
|
0
|
my $cache = |
24
|
|
|
|
|
|
|
CHI->new( driver => 'File', %params, l1_cache => { driver => 'File' } ); |
25
|
0
|
|
|
|
|
0
|
foreach my $field (qw(expires_variance namespace on_get_error on_set_error)) |
26
|
|
|
|
|
|
|
{ |
27
|
0
|
|
|
|
|
0
|
is( $cache->$field, $cache->l1_cache->$field, "$field matches" ); |
28
|
|
|
|
|
|
|
} |
29
|
0
|
|
|
|
|
0
|
is( $cache->l1_cache->serializer->serializer, |
30
|
|
|
|
|
|
|
'Data::Dumper', 'l1 cache serializer' ); |
31
|
0
|
|
|
|
|
0
|
is( $cache->depth, 4, 'cache depth' ); |
32
|
0
|
|
|
|
|
0
|
is( $cache->l1_cache->depth, 2, 'l1 cache depth' ); |
33
|
1
|
|
|
1
|
|
4
|
} |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub test_bad_subcache_option : Tests { |
36
|
1
|
|
|
1
|
0
|
771
|
my $self = shift; |
37
|
|
|
|
|
|
|
throws_ok( |
38
|
|
|
|
|
|
|
sub { |
39
|
1
|
|
|
1
|
|
36
|
CHI->new( |
40
|
|
|
|
|
|
|
driver => 'Memory', |
41
|
|
|
|
|
|
|
global => 1, |
42
|
|
|
|
|
|
|
l1_cache => CHI->new( driver => 'Memory', global => 1 ) |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
}, |
45
|
1
|
|
|
|
|
15
|
qr/Validation failed for|isa check for .*? failed/, |
46
|
|
|
|
|
|
|
'cannot pass cache object as subcache' |
47
|
|
|
|
|
|
|
); |
48
|
1
|
|
|
1
|
|
335
|
} |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |