Open petdance opened 7 years ago
Hi @petdance. The following resolves the issue. Also, added missing line in _test_serial.
--- Test/Perl/Critic.pm 2017-07-04 12:01:15.421579849 -0500
+++ Test/Perl/Critic.pm.fix 2017-11-21 21:30:50.478096779 -0600
@@ -92,7 +92,7 @@
my @files = Perl::Critic::Utils::all_perl_files(@dirs_or_files);
croak 'Nothing to critique' if not @files;
- my $have_mce = eval {require MCE::Grep};
+ my $have_mce = eval { require MCE::Grep; MCE::Grep->import; 1 };
return $have_mce ? _test_parallel(@files) : _test_serial(@files);
}
@@ -109,13 +109,15 @@
# workers. So we disable the T::B sanity checks at the end of its life.
$TEST->no_ending(1);
- my $okays = MCE::Grep::mce_grep { critic_ok($_) } @files;
+ my $okays = MCE::Grep->run( sub { critic_ok($_) }, @files );
my $pass = $okays == @files;
# To make Test::Harness happy, we must emit a test plan and a sensible exit
# status. Usually, T::B does this for us, but we disabled the ending above.
$pass || eval 'END { $? = 1 }'; ## no critic qw(Eval Interpolation)
- return $TEST->done_testing(scalar @files);
+ $TEST->done_testing(scalar @files);
+
+ return $pass;
}
#---------------------------------------------------------------------------
@@ -126,6 +128,8 @@
my $okays = grep {critic_ok($_)} @files;
my $pass = $okays == @files;
+ $TEST->done_testing(scalar @files);
+
return $pass;
}
I tested Test-Perl-Critic without and with MCE 1.827 through 1.832.
Applied. Thank.s
When MCE is installed, xt/96_perlcritic.t fails because no filenames get passed to
critic_ok