Skip to content

Commit

Permalink
rewrite the setup part of command-clone-modules.t
Browse files Browse the repository at this point in the history
Now that we have this `list_modules` method, the mocking is a bit more
straightforwad.
  • Loading branch information
gugod committed Jun 30, 2021
1 parent d31b879 commit dd7cc83
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions t/command-clone-modules.t
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,15 @@ mock_perlbrew_install("perl-5.16.0");

no warnings;
my ($__from, $__to, $__notest);
sub App::perlbrew::list_modules {
my ($self, $env) = @_;
$__from = $env || $self->current_env;
return ["Foo", "Bar"];
}

sub App::perlbrew::run_command_exec {
my ($self, @args) = @_;

diag "ARGS: @args";

if (grep { $_ eq '-MExtUtils::Installed' } @args) {
$__from = $args[1];

my ($fn) = $args[5] =~ m{open .+">", "(.+?)";};
if ($fn) {
open my $fh, ">", $fn;
print $fh "Foo\nBar\n";
close($fh);
} else {
die "Failed to grok output path.";
}
} elsif (grep { $_ eq 'cpanm' } @args) {
if (grep { $_ eq 'cpanm' } @args) {
$__to = $args[1];
($__notest) = grep { $_ eq '--notest' } @{$self->{original_argv}};
}
Expand Down

0 comments on commit dd7cc83

Please sign in to comment.