File Coverage

t/build.t
Criterion Covered Total %
statement 17 27 62.9
branch 1 2 50.0
condition n/a
subroutine 5 5 100.0
pod n/a
total 23 34 67.6


line stmt bran cond sub pod time code
1 1     1   409 use Test::Most 0.25;
  1         24720  
  1         5  
2 1     1   25579 use Test::Command 0.10;
  1         17040  
  1         8  
3              
4 1     1   532 use Path::Class;
  1         13403  
  1         47  
5 1     1   5 use File::Temp qw< tempdir >;
  1         1  
  1         1407  
6              
7              
8 1         4 my $dir = tempdir( CLEANUP => 1 );
9              
10 1         452 my @filter_out =
11             (
12             '\[DZ\].*',
13             '\[(@BAREFOOT/)?ReadmeAnyFromPod\] (?i:overrid\w+) README\.pod in root',
14             );
15              
16              
17             # pop back up to actual dist dir for this test
18             # if doing an actual install, there is no actual dist dir, so just skip all
19             #diag `pwd ; ls`;
20 1     1   4 sub inside_build_dir { grep { $_ eq '.build' } dir()->absolute->components }
  6         180  
21 1 50       2 plan skip_all => "can't understand my current directory structure [" . dir()->absolute . "]" unless inside_build_dir();
22 0         0 chdir '..' while inside_build_dir();
23              
24             # try to build again, but in a temp dir
25             # * keeps from building in a build dir, which does very wonky things
26             # * tempdir can be cleaned up automatically, so no need to do a dzil clean
27             # ** (which is good, because clean doesn't take an --in param)
28 0         0 my $cmd = Test::Command->new( cmd => "dzil build --in $dir" );
29 0         0 my $stdout = $cmd->stdout_value;
30 0         0 my $stderr = $cmd->stderr_value;
31              
32             # remove lines we don't care about
33 0         0 for ($stdout, $stderr)
34             {
35 0         0 foreach my $pattern (@filter_out)
36             {
37 0         0 s/^$pattern\n//mg;
38             }
39             }
40              
41 0         0 is $stdout, '', 'no unexpected lines in build';
42 0         0 is $stderr, '', 'no error lines in build';
43              
44              
45 0         0 done_testing;