SharedMem/t/CHIDriverTests.pm

filter: Statementstmt 97.2% 35 / 36 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod 100% 3 / 3 totaltotal 96.1% 50 / 52 SCAR 6.9
CC
2
Cov
95%
test_shmkey_required
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« SharedMem.pm ↑ Summary
1 package CHI::Driver::SharedMem::t::CHIDriverTests;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use CHI::Test;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use base qw(CHI::t::Driver);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Test::Warn;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use IPC::SysV;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 use CHI::Test::Util
11 2 ▶ qw(activate_test_logger cmp_bool is_between random_string skip_until);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 =head1 NAME
14  
15 CHI::Driver::SharedMem::t::CHIDriverTests
16  
17 =head1 VERSION
18  
19 Version 0.18
20  
21 =cut
22  
23 2 our $VERSION = '0.18';
24  
25 =head1 SYNOPSIS
26  
27 CHI::Driver::SharedMem::t::CHIDriverTests - test CHI::Driver::SharedMem
28  
29 =cut
30  
31 =head1 SUBROUTINES/METHODS
32  
33 =head2 testing_driver_class
34  
35 Declare the driver being tested
36  
37 =cut
38  
39 sub testing_driver_class {
40 90 ▶ return 'CHI::Driver::SharedMem';
Subroutine testing_driver_class: called CC=1 SCAR=0.0
Pod documented
41 }
42  
43 =head2 new_cache_options
44  
45 =cut
46 sub new_cache_options {
47 86 ▶ my $self = shift;
Subroutine new_cache_options: called CC=1 SCAR=0.0
Pod documented
48  
49 return (
50 86 $self->SUPER::new_cache_options(),
51 driver => '+CHI::Driver::SharedMem',
52 shm_size => $main::shm_size,
53 shm_key => $main::shm_key,
54 );
55 }
56  
57 =head2 test_shmkey_required
58  
59 Verify that the shmkey option is mandatory
60  
61 =cut
62  
63 sub test_shmkey_required : Tests {
64 1 ▶ my $cache;
Subroutine test_shmkey_required: called CC=2 SCAR=7.1
Pod documented
65  
66 1 eval {
67 1 $cache = CHI->new(driver => 'SharedMem');
68 };
69 1 ▶ if($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) { } 1 0 1
70 1 ok($@ =~ /CHI::Driver::SharedMem - no key given/);
71 1 ok(!defined($cache));
72 } else {
73 0 ok(0, 'Allowed shm_key to be undefined');
74 }
75 2 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
76  
77 2 1;
« SharedMem.pm ↑ Summary