Skip to content

Commit

Permalink
Replace the use of Test::Deep with their Test2 alternatives
Browse files Browse the repository at this point in the history
  • Loading branch information
gugod committed Aug 30, 2024
1 parent ae0cf60 commit 91fe5fc
Showing 1 changed file with 13 additions and 23 deletions.
36 changes: 13 additions & 23 deletions t/app-perlbrew-path-installation.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ use Test2::Tools::Spec;

use File::Temp qw[];

use Test::Deep;

use App::Perlbrew::Path::Root;
use App::Perlbrew::Path::Installation;
use App::Perlbrew::Path::Installations;
Expand All @@ -22,26 +20,22 @@ describe "App::Perlbrew::Path::Root" => sub {
it "should return Instalations object" => sub {
local $ENV{HOME};
my $path = arrange_root->perls;

cmp_deeply $path, looks_like_perl_installations("~/.root/perls");
is $path, looks_like_perl_installations("~/.root/perls");
};
};

describe "with one parameter" => sub {
it "should return Installation object" => sub {
local $ENV{HOME};
my $path = arrange_root->perls('blead');

cmp_deeply $path, looks_like_perl_installation("~/.root/perls/blead");
is $path, looks_like_perl_installation("~/.root/perls/blead");
};
};

describe "with multiple paramters" => sub {
it "should return Path object" => sub {
local $ENV{HOME};
my $path = arrange_root->perls('blead', '.version');

cmp_deeply $path, looks_like_path("~/.root/perls/blead/.version");
is $path, looks_like_path("~/.root/perls/blead/.version");
};
}
};
Expand All @@ -57,7 +51,7 @@ describe "App::Perlbrew::Path::Installations" => sub {

my @list = $root->perls->list;

cmp_deeply \@list, [
is \@list, [
looks_like_perl_installation("~/.root/perls/perl-1"),
looks_like_perl_installation("~/.root/perls/perl-2"),
];
Expand All @@ -70,22 +64,19 @@ describe "App::Perlbrew::Path::Installation" => sub {
it "should return installation name" => sub {
local $ENV{HOME};
my $installation = arrange_installation('foo-bar');

cmp_deeply $installation->name, 'foo-bar';
is $installation->name, 'foo-bar';
};

it "should provide path to perl" => sub {
local $ENV{HOME};
my $perl = arrange_installation('foo-bar')->perl;

cmp_deeply $perl->stringify_with_tilde, '~/.root/perls/foo-bar/bin/perl';
is $perl->stringify_with_tilde, '~/.root/perls/foo-bar/bin/perl';
};

it "should provide path to version file" => sub {
local $ENV{HOME};
my $file = arrange_installation('foo-bar')->version_file;

cmp_deeply $file->stringify_with_tilde, '~/.root/perls/foo-bar/.version';
is $file->stringify_with_tilde, '~/.root/perls/foo-bar/.version';
};
};
};
Expand All @@ -100,19 +91,18 @@ sub looks_like_path {
: 'stringify'
;

all(
methods($method => $path),
Isa('App::Perlbrew::Path'),
@tests,
);
object {
call $method => $path;
prop isa => 'App::Perlbrew::Path';
};
}

sub looks_like_perl_installation {
looks_like_path(@_, Isa('App::Perlbrew::Path::Installation'));
looks_like_path(@_, object { prop isa => 'App::Perlbrew::Path::Installation' });
}

sub looks_like_perl_installations {
looks_like_path(@_, Isa('App::Perlbrew::Path::Installations'));
looks_like_path(@_, object { prop isa => 'App::Perlbrew::Path::Installation' });
}

sub arrange_root {
Expand Down

0 comments on commit 91fe5fc

Please sign in to comment.