-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
critic_ok() in xt/96_perlcritic.t doesn't work with MCE running #9
Comments
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. |
colinnewell
added a commit
to cv-library/Test-Perl-Critic
that referenced
this issue
Jan 3, 2018
Closed
Applied. Thank.s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When MCE is installed, xt/96_perlcritic.t fails because no filenames get passed to
critic_ok
The text was updated successfully, but these errors were encountered: