-
Notifications
You must be signed in to change notification settings - Fork 0
/
tdist.t
78 lines (54 loc) · 1.38 KB
/
tdist.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
use Test::Most 0.25;
use Test::Command 0.10;
use Dist::Zilla::App;
use Path::Tiny qw< path cwd tempdir >;
our $tdist = tempdir( CLEANUP => 1 );
# go to our temp dir for this test
my $old = cwd;
END { chdir $old } # go back to original dir so cleanup of temp dir can happen
chdir $tdist;
# create a skeletal distribution
my $tname = 'Test-Module';
my $tversion = '0.01';
#[@Filter]
#-bundle = @BAREFOOT
#-remove = GitHubMeta
path('dist.ini')->spew( <<END );
name = $tname
author = Buddy Burden <barefoot\@cpan.org>
license = Artistic_2_0
copyright_holder = Buddy Burden
version = $tversion
[\@BAREFOOT]
fake_release = 1
repository_link = none
END
my $lib = path( 'lib', 'Test' );
$lib->mkpath;
$lib->path('Module.pm')->spew( <<'END' );
class Test::Module with Some::Role
{
# ABSTRACT: Just a module for testing
# VERSION
}
1;
END
my $t = path( 't' );
$t->mkpath;
$t->path('require.t')->spew( <<'END' );
use Test::Most 0.25;
require_ok( 'Test::Module' );
done_testing;
END
# now build our test dist so we can have some files to test
run_dzil_command("build");
chdir "$tname-$tversion" or die("failed to run dzil");
my $meta = path('META.json')->slurp;
like $meta, qr/"version" \s* : \s* "$tversion"/x, 'version is correct in meta';
like $meta, qr/"provides" \s* : /x, 'contains a `provides` in meta';
done_testing;
sub run_dzil_command
{
local @ARGV = @_;
Dist::Zilla::App->run;
}