how do I test that a function returns nothing when called in void context?
Two thoughts:
If a function returned a value in a void context, it is just discarded.
Not returning anything in a void context is not the point, it is not calculating the return values if they are never going to be used that makes a difference.
If the first line of the sub is return unless defined wantarray;, the sub will not return anything when called in a void context. There is no need to test that.
In reply to Re: Unit testing, context and wantarray
by BrowserUk
in thread Unit testing, context and wantarray
by mikeman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |