File Coverage

blib/lib/Class/Mock/Common.pm
Criterion Covered Total %
statement 20 20 100.0
branch 3 6 50.0
condition n/a
subroutine 4 4 100.0
pod n/a
total 27 30 90.0


line stmt bran cond sub pod time code
1             package Class::Mock::Common;
2              
3 2     2   12 use strict;
  2         12  
  2         50  
4 2     2   9 use warnings;
  2         3  
  2         163  
5              
6             our $VERSION='1.3002';
7              
8             sub _get_tests_from_file {
9 3     3   10 my $filename = shift;
10 3         17 local $/ = undef;
11 3 50       134 open(my $fh, '<', $filename) || die("Can't open $filename: $!\n");
12 3         104 my $content = <$fh>;
13 3         28 close($fh);
14 3         8 my $tests = do {
15 2     2   11 no strict;
  2         4  
  2         167  
16 3         382 eval($content);
17             };
18 3 50       17 die("File $filename isn't valid perl\n") if($@);
19 3 50       13 die("File $filename didn't evaluate to an arrayref\n")
20             unless(ref($tests) eq 'ARRAY');
21 3         6 return @{$tests};
  3         19  
22             }
23              
24             1;