-
Notifications
You must be signed in to change notification settings - Fork 220
/
Copy pathinstallation.t
55 lines (42 loc) · 1.41 KB
/
installation.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
#!/usr/bin/env perl
use Test2::V0;
use FindBin;
use lib $FindBin::Bin;
use App::perlbrew;
require 'test2_helpers.pl';
## main
note "PERLBREW_ROOT set to $ENV{PERLBREW_ROOT}";
{
my $app = App::perlbrew->new;
my @installed = grep { !$_->{is_external} } $app->installed_perls;
is 0+@installed, 0;
}
{
my $app = App::perlbrew->new("install", "perl-5.14.0");
$app->run;
my @installed = grep { !$_->{is_external} } $app->installed_perls;
is 0+@installed, 1;
is $installed[0]->{name}, "perl-5.14.0";
ok dies {
my $app = App::perlbrew->new("install", "perl-5.14.0");
$app->run;
}, "should die when doing install with existing distribution name.";
}
subtest "App::perlbrew#is_installed method." => sub {
my $app = App::perlbrew->new;
ok $app->can("is_installed");
ok $app->is_installed("perl-5.14.0");
ok !$app->is_installed("perl-5.13.0");
};
subtest "do not clobber exitsing user-specified name." => sub {
my $app = App::perlbrew->new("install", "perl-5.14.0", "--as", "the-dude");
$app->run;
my @installed = grep { !$_->{is_external} } $app->installed_perls;
is 0+@installed, 2;
ok grep { $_->{name} eq 'the-dude' } $app->installed_perls;
ok dies {
my $app = App::perlbrew->new("install", "perl-5.14.0", "--as", "the-dude");
$app->run;
}, "should die when doing install with existing user-specified name.";
};
done_testing;