Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
68 lines (50 sloc) 1.82 KB
=begin yada yada
Copy this snippet to the beginning of tests:
use FindBin;
use lib $FindBin::Bin;
use App::perlbrew;
require '';
tldr: This file should be `require`-ed after the "use App::perlbrew;" statement in
the test. It is meant to override subroutines for testing purposes and not
mess up developer's own perlbrew environment. `FindBin` should be used to
put 't/' dir to `@INC`.
use Test::More;
use Path::Class;
use IO::All;
use File::Temp qw( tempdir );
$App::perlbrew::PERLBREW_ROOT = tempdir( CLEANUP => 1 );
$App::perlbrew::PERLBREW_HOME = tempdir( CLEANUP => 1 );
App::perlbrew::mkpath( dir($ENV{PERLBREW_ROOT})->subdir("perls") );
App::perlbrew::mkpath( dir($ENV{PERLBREW_ROOT})->subdir("build") );
App::perlbrew::mkpath( dir($ENV{PERLBREW_ROOT})->subdir("dists") );
no warnings 'redefine';
sub App::perlbrew::do_install_release {
my ($self, $name) = @_;
$name = $self->{as} if $self->{as};
my $root = dir($App::perlbrew::PERLBREW_ROOT);
my $installation_dir = $root->subdir("perls", $name);
App::perlbrew::mkpath($root->subdir("perls", $name, "bin"));
my $perl = $root->subdir("perls", $name, "bin")->file("perl");
#!/usr/bin/env perl
use File::Basename;
my $name = basename(dirname(dirname($0))), "\n";
$name =~ s/^perl-//;
my ($a,$b,$c) = split /\./, $name;
printf('%d.%03d%03d' . "\n", $a, $b, $c);
chmod 0755, $perl;
note "(mock) installed $name to $installation_dir";
sub mock_perlbrew_install {
my ($name, @args) = @_;
App::perlbrew->new(install => $name, @args)->run();
sub mock_perlbrew_lib_create {
my $name = shift;
App::perlbrew::mkpath(dir($App::perlbrew::PERLBREW_HOME, "libs", $name));
Something went wrong with that request. Please try again.