Test/Enbld/Definition.pm untested

filter: Statementstmt 0.0% 0 / 65 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 14 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 84 SCAR 24.8
CC
3
Cov
0%
build_ok
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 12.0
1 package Test::Enbld::Definition;
2  
3 use strict;
4 use warnings;
5  
6 use Test::Builder::Module;
7  
8 use File::Temp;
9 use File::Spec;
10 use File::Path qw/make_path/;
11 use File::Copy;
12 use FindBin;
13  
14 require Enbld::Home;
15 require Enbld::Logger;
16 require Enbld::Target;
17 require Enbld::Condition;
18  
19 my $CLASS = __PACKAGE__;
20  
21 use parent qw/Test::Builder::Module/;
22  
23 our @EXPORT = qw/build_ok/;
24  
25 sub build_ok($;$$$) {
26 my $name = $_[0];
27 my $config = $_[1];
28 my $condition = $_[2];
29 my $description = $_[3];
30  
31 local $ENV{PERL_ENBLD_HOME} = File::Temp->newdir;
32  
33 Enbld::Home->initialize;
34 Enbld::Home->create_build_directory;
35  
36 Enbld::Logger->rotate( Enbld::Home->log );
37  
38 my $target = Enbld::Target->new( $name, $config );
39  
40 my $installed;
41 if ( $condition ) {
42 eval { $installed = $target->install_declared( $condition ) };
43 } else {
44 eval { $installed = $target->install };
45 }
46  
47 my $tb = $CLASS->builder;
48  
49 chdir $FindBin::Bin;
50  
51 if ( $@ ) {
52 $tb->diag( "Error occured, please check logfile." );
53  
54 my $logfile = File::Spec->catfile(
55 $FindBin::Bin,
56 'build_' . time . '_log.txt'
57 );
58 $tb->diag( "logfile:" . $logfile );
59 copy( Enbld::Logger->logfile, $logfile );
60  
61 return $tb->BAIL_OUT( $@ );
62 }
63  
64 return $tb->ok(@_);
65 }
66  
67 1;