File Coverage

blib/lib/Test/Alien/CanCompile.pm
Criterion Covered Total %
statement 17 18 94.4
branch 4 4 100.0
condition n/a
subroutine 6 6 100.0
pod 0 1 0.0
total 27 29 93.1


line stmt bran cond sub pod time code
1             package Test::Alien::CanCompile;
2              
3 2     2   229233 use strict;
  2         12  
  2         61  
4 2     2   12 use warnings;
  2         5  
  2         46  
5 2     2   41 use 5.008004;
  2         8  
6 2     2   11 use Test2::API qw( context );
  2         4  
  2         362  
7              
8             # ABSTRACT: Skip a test file unless a C compiler is available
9             our $VERSION = '2.45'; # VERSION
10              
11              
12             sub skip
13             {
14 5     5 0 236525 require ExtUtils::CBuilder;
15 5 100       61 ExtUtils::CBuilder->new->have_compiler ? undef : 'This test requires a compiler.';
16             }
17              
18             sub import
19             {
20 2     2   10924 my $skip = __PACKAGE__->skip;
21 2 100       16257 return unless defined $skip;
22              
23 1         150 my $ctx = context();
24 1         124 $ctx->plan(0, SKIP => $skip);
25 0           $ctx->release;
26             }
27              
28             1;
29              
30             __END__