File Coverage

t/tdist.t
Criterion Covered Total %
statement 30 30 100.0
branch 1 2 50.0
condition n/a
subroutine 5 5 100.0
pod n/a
total 36 37 97.3


line stmt bran cond sub pod time code
1 1     1   402 use Test::Most 0.25;
  1         24962  
  1         5  
2              
3 1     1   25789 use Dist::Zilla::App;
  1         29133  
  1         10  
4 1     1   805 use Path::Tiny qw< path cwd tempdir >;
  1         6742  
  1         1422  
5              
6              
7 1         3 our $tdist = tempdir( CLEANUP => 1 );
8              
9              
10             # go to our temp dir for this test
11 1         13050 my $old = cwd;
12 1     1   668 END { chdir $old } # go back to original dir so cleanup of temp dir can happen
13 1         20 chdir $tdist;
14              
15              
16             # create a skeletal distribution
17              
18 1         11 my $tname = 'Test-Module';
19 1         3 my $tversion = '0.01';
20              
21 1         2 path('dist.ini')->spew( <<END );
22             name = $tname
23             author = Buddy Burden <barefoot\@cpan.org>
24             license = Artistic_2_0
25             copyright_holder = Buddy Burden
26              
27             version = $tversion
28             [\@BAREFOOT]
29             fake_release = 1
30             repository_link = none
31             END
32              
33 1         294 my $lib = path( 'lib', 'Test' );
34 1         23 $lib->mkpath;
35 1         179 $lib->path('Module.pm')->spew( <<'END' );
36             # blank lines before and after PODCLASSNAME are required by PodnameFromClassname
37             # (for whatever reason)
38              
39             # PODCLASSNAME
40              
41             class Test::Module with Some::Role
42             {
43             # ABSTRACT: Just a module for testing
44             # VERSION
45             }
46              
47             1;
48             END
49              
50 1         258 my $t = path( 't' );
51 1         21 $t->mkpath;
52 1         85 $t->path('require.t')->spew( <<'END' );
53             use Test::Most 0.25;
54              
55             require_ok( 'Test::Module' );
56              
57             done_testing;
58             END
59              
60              
61             # now build our test dist so we can have some files to test
62              
63 1         219 run_dzil_command("build");
64 1 50       715390 chdir "$tname-$tversion" or die("failed to run dzil");
65              
66 1         11 my $meta = path('META.json')->slurp;
67              
68 1         272 like $meta, qr/"version" \s* : \s* "$tversion"/x, 'version is correct in meta';
69 1         490 like $meta, qr/"provides" \s* : /x, 'contains a `provides` in meta';
70              
71              
72 1         283 done_testing;
73              
74              
75             sub run_dzil_command
76             {
77 1     1   3 local @ARGV = @_;
78 1         15 Dist::Zilla::App->run;
79             }