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   201745 use strict;
  2         11  
  2         57  
4 2     2   10 use warnings;
  2         3  
  2         48  
5 2     2   41 use 5.008004;
  2         6  
6 2     2   10 use Test2::API qw( context );
  2         3  
  2         346  
7              
8             # ABSTRACT: Skip a test file unless a C compiler is available
9             our $VERSION = '2.46'; # VERSION
10              
11              
12             sub skip
13             {
14 5     5 0 204440 require ExtUtils::CBuilder;
15 5 100       45 ExtUtils::CBuilder->new->have_compiler ? undef : 'This test requires a compiler.';
16             }
17              
18             sub import
19             {
20 2     2   9034 my $skip = __PACKAGE__->skip;
21 2 100       13453 return unless defined $skip;
22              
23 1         132 my $ctx = context();
24 1         116 $ctx->plan(0, SKIP => $skip);
25 0           $ctx->release;
26             }
27              
28             1;
29              
30             __END__