How to mark all statements in subroutine as uncoverable
How can I mark all statements in a subroutine as uncoverable (other than putting an "uncoverable statement" comment before each one)?
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.
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. :)
Seems like # uncoverable subroutine does this?
See http://search.cpan.org/~pjcj/Devel-Cover-1.29/lib/Devel/Cover.pm#Subroutines
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.
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.
I mean, any statement in a block following an uncoverable statement should be uncoverable. (Unless there is a goto present.)
See more analysis in #212