App-makefilepl2cpanfile
view release on metacpan or search on metacpan
t/edge_cases.t view on Meta::CPAN
ok scalar @warnings > 0,
'carp emitted for rejected module name';
like $warnings[0], qr/invalid module name/i,
'carp message identifies the problem';
diag "Output:\n$out\nWarnings: @warnings" if $ENV{TEST_VERBOSE};
};
subtest 'security: YAML config crafted name that would inject code is rejected' => sub {
# Confirm the most dangerous payload â a name that closes the single-quoted
# string and inserts a system() call â is blocked before it can reach
# _fmt_dep and appear in the cpanfile.
Readonly my $PAYLOAD => "Safe'; warn q(INJECTED); requires 'Safe2";
my $g = home_with_config( { develop => { $PAYLOAD => 0 } } );
my $mf = make_mf($MF_SIMPLE);
my $out = App::makefilepl2cpanfile::generate(
makefile => "$mf",
with_develop => 1,
);
t/edge_cases.t view on Meta::CPAN
die "read: $!\n";
};
throws_ok {
App::makefilepl2cpanfile::generate(makefile => "$mf", with_develop => 0)
} qr/\Q$MSG_EIO\E/,
"EIO mid-slurp propagates with canonical '$MSG_EIO' string";
};
subtest 'io-failure-read: EINTR (interrupted syscall) mid-slurp â propagates' => sub {
# An async signal (SIGALRM, SIGTERM) arrived while sysread() was blocked.
# The kernel set errno = EINTR. Path::Tiny does not automatically retry;
# the exception propagates to generate()'s caller.
my $g_home = empty_home();
my $mf = make_mf($MF_SIMPLE);
my $g_slurp = mock_scoped 'Path::Tiny::slurp_utf8' => sub {
local $! = EINTR;
die "sysread: $!\n";
};
throws_ok {
( run in 2.616 seconds using v1.01-cache-2.11-cpan-800906f7e73 )