File: installation.t

package info (click to toggle)
perlbrew 0.78-1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 708 kB
  • sloc: perl: 6,291; makefile: 6
file content (59 lines) | stat: -rw-r--r-- 1,493 bytes parent folder | download | duplicates (6)
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
#!/usr/bin/env perl
use strict;
use warnings;

use FindBin;
use lib $FindBin::Bin;
use App::perlbrew;
require 'test_helpers.pl';

use Test::More;
use Test::Exception;

## 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";

    dies_ok {
        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;

    dies_ok {
        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;