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   14 use strict;
  2         16  
  2         61  
4 2     2   10 use warnings;
  2         4  
  2         206  
5              
6             our $VERSION='1.3001';
7              
8             sub _get_tests_from_file {
9 3     3   8 my $filename = shift;
10 3         25 local $/ = undef;
11 3 50       180 open(my $fh, '<', $filename) || die("Can't open $filename: $!\n");
12 3         107 my $content = <$fh>;
13 3         34 close($fh);
14 3         9 my $tests = do {
15 2     2   14 no strict;
  2         3  
  2         190  
16 3         416 eval($content);
17             };
18 3 50       20 die("File $filename isn't valid perl\n") if($@);
19 3 50       21 die("File $filename didn't evaluate to an arrayref\n")
20             unless(ref($tests) eq 'ARRAY');
21 3         6 return @{$tests};
  3         29  
22             }
23              
24             1;