File-Corresponding
view release on metacpan or search on metacpan
t/corresponding-group-corresponding.t view on Meta::CPAN
use strict;
use warnings;
use Test::More tests => 8;
use Test::Exception;
use Test::Differences;
use File::chdir;
use File::Basename;
use Path::Class qw/ dir file /;
use lib "lib";
use File::Corresponding::Group;
use File::Corresponding::File::Profile;
use File::Corresponding::File::Found;
{
local $CWD = dir( dirname(__FILE__), "data" );
diag("No profiles");
ok(
my $group = File::Corresponding::Group->new({
name => "ABC files",
}),
"Create new empty group",
);
is_deeply(
$group->corresponding("bogus file"),
[],
"->corresponding with no profiles returns empty arrayref",
);
diag("Setup a config to match things under data/corresponding");
ok(
$group = File::Corresponding::Group->new({
name => "Number files",
file_profiles => [
my $profile_abc = File::Corresponding::File::Profile->new({
name => "abc",
regex => qr|abc/([\w.]+)$|,
sprintf => "abc/%s"
}),
my $profile_def = File::Corresponding::File::Profile->new({
name => "def",
regex => qr|elsewhere/def/([\w.]+)$|,
sprintf => "elsewhere/def/%s"
}),
my $profile_ghi = File::Corresponding::File::Profile->new({
name => "ghi",
regex => qr|ghi/([\w.]+)$|,
sprintf => "ghi/%s"
}),
]
}),
( run in 0.902 second using v1.01-cache-2.11-cpan-2398b32b56e )