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
Make the purpose of done_testing and the plan clearer #151
Comments
I'm embarrassed to say that I used |
Nit -- END blocks are not executed for exec() or when signal are caught. (c.f perlmod) Since the harness will catch any non-zero exit code anyway (from die(), signals or "exit $nonzero") it seems the major benefit of done_testing is to help Test::More catch premature exit 0. |
I wonder if I can make done_testing warn if it detects it is in an END block. Not completely sure how to accomplish that, but I am guessing there is a var somewhere that will let us detect a global cleanup? Or this:
Not sure if I got that completely right, but I know an exception thrown in an END block has a similar message. |
nevermind |
${^GLOBAL_PHASE} looks like it is what I want Not available in all perl versions, but I can at least use it on ones that do. |
I am just going to document the issue. Adding END detection is a problem because using caller to detect END is the only viable way, but that causes SEGV in some cases, which is bad. |
A few people were doing this:
This defeats the protections of
done_testing
because...I figure people should be able to work that out from those principles, but @dagolden pointed out that #1 isn't documented. The whole point of the plan is a bit muddled.
So....
I only caught three people doing
END { done_testing }
, not enough to take up space in the docs. I'd rather focus on conveying the principles so people can think intelligently aboutdone_testing
rather than list every mistake we've seen.The text was updated successfully, but these errors were encountered: