Skip to content
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

turning off line numbering can break the renderer #16

Closed
rjbs opened this issue May 5, 2023 · 0 comments · Fixed by #17
Closed

turning off line numbering can break the renderer #16

rjbs opened this issue May 5, 2023 · 0 comments · Fixed by #17

Comments

@rjbs
Copy link
Contributor

rjbs commented May 5, 2023

Here is a test from andk/PAUSE

use strict;
use warnings;
use File::Spec;
use Test::More;

if ($ENV{NO_PERL_CRITIC}) {
    plan( skip_all => '$NO_PERL_CRITIC set, skipping');
}

eval { require Test::Perl::Critic; };

if ( $@ ) {
    my $msg = 'Test::Perl::Critic required to criticise code';
    plan( skip_all => $msg );
}

my $rcfile = File::Spec->catfile( 't', 'perlcriticrc' );
Test::Perl::Critic->import( -profile => $rcfile );
all_critic_ok();

Test::Perl::Critic does $TEST->use_numbers(0). Later, in the JUnit renderer, this line fires:

my $test_num    = sprintf( "%04d", $event->{'assert_count'} || $f->{'assert'}->{'number'} || die Dumper $event);

There are no numbers, and (I think this matters), the plan runs before there's any count of asserts. We hit the die, which just blats a dump to the screen and exits.

At least the Dumper should include "can't handle assert with no number", but better, it should cope somehow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant