in reply to Re^6: STDERR in Test Results
in thread STDERR in Test Results

However, I will not call die.

I agree with afoken's "WTF" here.

There are many instances where it would be dangerous to NOT throw an exception. For example... my webapp that front-ends a connection to Tesla's API... you hammer that too hard without a proper auth token and I don't throw, that may cause issues. I'm not going to nicely keep telling you to please don't do that, I'm breaking your caller.

Another example is my IPC::Shareable software. If you try to write to a memory location that isn't yours, you should know better, and I'm throwing an exception.

The case that's relative here is the test software. Your tests should use a liberal amount of throws_ok() or similar to ensure that you catch as many possible exception cases as your software throws.

Here's an example use of throws_ok():

use Test::Exception; throws_ok { 0/0 } qr/Illegal division by zero/, "whatever_sub() throws if trying to divide by zero ok";

You can do it without Test::Exception with a bit more work:

my $div_by_zero_ok = eval { 0 / 0; 1; }; is $div_by_zero_ok, undef, "whatever_sub() barfs properly if dividing by zero ok";