Devel--Cover icon indicating copy to clipboard operation
Devel--Cover copied to clipboard

How to mark all statements in subroutine as uncoverable

Open macrotex opened this issue 13 years ago • 7 comments

How can I mark all statements in a subroutine as uncoverable (other than putting an "uncoverable statement" comment before each one)?

macrotex avatar Feb 03 '13 20:02 macrotex

Unfortunately, there is no way to do this at the moment. I will leave this ticket open as a reminder that this should be done.

pjcj avatar Feb 10 '13 14:02 pjcj

Actually, the more general issue is how to mark a "block" as uncoverable. For example, if there is an IF statement and you're normally never going to be able to execute the ELSE because that's only for when things go horribly wrong, (presently) you have to mark each statement in the ELSE as uncoverable. It'd be really nice to be able to do "uncoverable block" and that would hold for all statements/branches/conditions from there until the closing brace of the block that the directive is in. So in my example, we'd put it at the top just under/after the opening brace and all would be good. :)

Now that it's over 3 years later, I hope you have time to get to this soon. :)

kbrannen avatar Aug 03 '16 13:08 kbrannen

Seems like # uncoverable subroutine does this? See http://search.cpan.org/~pjcj/Devel-Cover-1.29/lib/Devel/Cover.pm#Subroutines

FROGGS avatar Jun 25 '18 07:06 FROGGS

On 06/25/2018 02:38 AM, Tobias Leich wrote:

Seem like |# uncoverable subroutine| does this? See http://search.cpan.org/~pjcj/Devel-Cover-1.29/lib/Devel/Cover.pm#Subroutines http://search.cpan.org/%7Epjcj/Devel-Cover-1.29/lib/Devel/Cover.pm#Subroutines

Sorry to have to say this, but go read the link you gave and you'll see that it does NOT automatically mark all the statements as uncoverable. To quote it:

Ideally all other criteria in the subroutine would be marked as uncoverable automatically, but that isn't the case at the moment.

But that is what would be really useful, as would being able to mark a block as uncoverable. I'd really like to see it done on a block-level as that would satisfy both needs.

K.

kbrannen avatar Jul 02 '18 05:07 kbrannen

I read this as "All statements shall be treated as uncoverable, if the first statement already is uncoverable." But "uncoverable subroutine" should have the desired effect already, no? Or does this have no effect? Is it just a comment?

I'm confused.

FROGGS avatar Jul 02 '18 06:07 FROGGS

I mean, any statement in a block following an uncoverable statement should be uncoverable. (Unless there is a goto present.)

FROGGS avatar Jul 02 '18 06:07 FROGGS

See more analysis in #212

pjcj avatar Jul 09 '18 18:07 pjcj