• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gugod / App-perlbrew / 10624839896

30 Aug 2024 12:47AM UTC coverage: 80.187% (+0.4%) from 79.799%
10624839896

push

github

3165 of 3947 relevant lines covered (80.19%)

81.25 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.31
/t/command-clone-modules.t
1
#!/usr/bin/env perl
2
use Test2::V0;
1✔
3
use Test2::Tools::Spec;
1✔
4

5
BEGIN { $ENV{SHELL} = "/bin/bash" }
1✔
6

7
use FindBin;
1✔
8
use lib $FindBin::Bin;
1✔
9
use App::perlbrew;
1✔
10
require "test2_helpers.pl";
×
11

12
mock_perlbrew_install("perl-5.14.1");
×
13
mock_perlbrew_install("perl-5.16.0");
×
14

15
no warnings;
1✔
16
my ($__from, $__to, $__notest);
1✔
17
sub App::perlbrew::list_modules {
18
    my ($self, $env)  = @_;
1✔
19
    $__from = $env || $self->current_env;
1✔
20
    return ["Foo", "Bar"];
1✔
21
}
22

23
sub App::perlbrew::run_command_exec {
24
    my ($self, @args) = @_;
4✔
25
    if (grep { $_ eq 'cpanm' } @args) {
4✔
26
        $__to = $args[1];
4✔
27
        ($__notest) = grep { $_ eq '--notest' } @{$self->{original_argv}};
4✔
28
    }
29
    return $self;
4✔
30
}
31
use warnings;
1✔
32

33
describe "clone-modules command," => sub {
34
    before_each 'cleanup env' => sub {
35
        delete $ENV{PERL_MB_OPT};
1✔
36
        delete $ENV{PERL_MM_OPT};
1✔
37
        delete $ENV{PERL_LOCAL_LIB_ROOT};
1✔
38
        delete $ENV{PERLBREW_LIB};
4✔
39
        delete $ENV{PERL5LIB};
4✔
40
        $__from = undef;
4✔
41
        $__to = undef;
4✔
42
        $__notest = undef;
4✔
43
    };
1✔
44

45
    describe "when invoked with two arguments, A and B", sub {
46
        it "should display clone modules from A to B", sub {
1✔
47
            my $app = App::perlbrew->new(
4✔
48
                "clone-modules", "perl-5.14.1", "perl-5.16.0"
49
            );
50
            $app->run;
1✔
51
            is $__from, "perl-5.14.1";
1✔
52
            is $__to, "perl-5.16.0";
1✔
53
            ok(!defined($__notest));
1✔
54
        };
4✔
55
    };
4✔
56

57
    describe "when invoked with two arguments, A and B, with `--notest`", sub {
58
        it "should display clone modules from A to B", sub {
59
            my $app = App::perlbrew->new(
1✔
60
                "clone-modules", "--notest", "perl-5.14.1", "perl-5.16.0"
61
            );
62
            $app->run;
1✔
63
            is $__from, "perl-5.14.1";
1✔
64
            is $__to, "perl-5.16.0";
1✔
65
            ok(defined($__notest));
1✔
66
        };
1✔
67
    };
1✔
68

69
    describe "when invoked with one argument X", sub {
70
        it "should display clone modules from current-perl to X", sub {
71
            my $app = App::perlbrew->new("clone-modules", "perl-5.14.1");
1✔
72

73
            my $mock = mocked($app)->expects("current_env")->returns("perl-5.16.0")->at_least(1);
1✔
74
            $app->run;
1✔
75

76
            is $__from, "perl-5.16.0";
1✔
77
            is $__to, "perl-5.14.1";
1✔
78
            ok(!defined($__notest));
1✔
79

80
            $mock->verify;
1✔
81
        };
1✔
82
    };
1✔
83

84
    describe "when invoked with one argument X, with `--notest`", sub {
85
        it "should display clone modules from current-perl to X", sub {
86
            my $app = App::perlbrew->new("clone-modules", "--notest", "perl-5.14.1");
1✔
87
            my $mock = mocked($app)->expects("current_env")->returns("perl-5.16.0")->at_least(1);
1✔
88
            $app->run;
1✔
89

90
            is $__from, "perl-5.16.0";
1✔
91
            is $__to, "perl-5.14.1";
1✔
92
            ok(defined($__notest));
1✔
93
            $mock->verify;
1✔
94
        };
1✔
95
    };
1✔
96
};
1✔
97

98
done_testing;
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc