App-Project-Doctor
view release on metacpan or search on metacpan
t/edge_cases.t view on Meta::CPAN
# ---------------------------------------------------------------------------
# Helpers
# ---------------------------------------------------------------------------
# Build a minimal temp distro from a { relative/path => content } hash.
sub _distro {
my (%files) = @_;
my $dir = tempdir(CLEANUP => 1);
for my $rel (sort keys %files) {
my @parts = split m{/}, $rel;
my $abs = File::Spec->catfile($dir, @parts);
make_path(dirname($abs)) unless -d dirname($abs);
open my $fh, '>', $abs or die "Cannot write $abs: $!";
print $fh $files{$rel};
close $fh;
}
return $dir;
}
# Return a Context rooted at a fresh temp dir (or supplied dir).
t/extended_tests.t view on Meta::CPAN
# ===========================================================================
# Test helpers
# ===========================================================================
# Build a temporary distro directory from a hash of relative_path => content.
sub _distro {
my (%files) = @_;
my $dir = tempdir(CLEANUP => 1);
for my $rel (sort keys %files) {
my @parts = split m{/}, $rel;
my $abs = File::Spec->catfile($dir, @parts);
make_path(dirname($abs)) unless -d dirname($abs);
open my $fh, '>', $abs or die "Cannot write $abs: $!";
print $fh $files{$rel};
close $fh;
}
return $dir;
}
sub _ctx {
t/function.t view on Meta::CPAN
# ---------------------------------------------------------------------------
# Shared helpers
# ---------------------------------------------------------------------------
# Build a temporary directory tree from a flat hash of rel-path => content.
sub make_distro {
my (%files) = @_;
my $dir = tempdir(CLEANUP => 1);
for my $rel (sort keys %files) {
my @parts = split m{/}, $rel;
my $abs = File::Spec->catfile($dir, @parts);
(my $parent = $abs) =~ s{[/\\][^/\\]+$}{};
make_path($parent) unless -d $parent;
open my $fh, '>', $abs or die "Cannot write $abs: $!";
print {$fh} $files{$rel};
close $fh;
}
return $dir;
}
t/integration.t view on Meta::CPAN
my $Report = 'App::Project::Doctor::Report';
my $Fixer = 'App::Project::Doctor::Fixer';
# ââ Shared helpers ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
# Build a temp directory tree from a %{ rel_path => content } hash.
sub _make_distro {
my (%files) = @_;
my $dir = tempdir(CLEANUP => 1);
for my $rel (sort keys %files) {
my @parts = split m{/}, $rel;
my $abs = File::Spec->catfile($dir, @parts);
make_path(dirname($abs)) unless -d dirname($abs);
open my $fh, '>', $abs or die "Cannot write $abs: $!";
print $fh $files{$rel};
close $fh;
}
return $dir;
}
# Create a Finding with the given named args.
# ---------------------------------------------------------------------------
# Shared helpers
# ---------------------------------------------------------------------------
# Create a temporary distribution directory tree from a flat path=>content map.
sub make_distro {
my (%files) = @_;
my $dir = tempdir(CLEANUP => 1);
for my $rel (sort keys %files) {
my @parts = split m{/}, $rel;
my $abs = File::Spec->catfile($dir, @parts);
(my $parent = $abs) =~ s{[/\\][^/\\]+$}{};
make_path($parent) unless -d $parent;
open my $fh, '>', $abs or die "Cannot write $abs: $!";
print {$fh} $files{$rel};
close $fh;
}
return $dir;
}
( run in 0.606 second using v1.01-cache-2.11-cpan-af0e5977854 )