I am trying to write a perl unit test. I am able to test happy-case scenario for it. However if there is an error generated in the method it prints the error using Carp:confess "<message>"
. I am not able to catch this case in my test.
I tried using
dies_ok( <method call>, 'Expected Error' );
However the test case still fails. It prints the message passed to Carp::confess and then prints
Looks like your test exited with 111 before it could output anything. Dubious, test returned 111 (wstat 28416, 0x6f00)
Is there a way I can catch this? I even tried throws_ok
but not working.
Please assist by guiding how I should catch these errors. Am I using these dies_ok
and throws_ok
incorrectly ?
You may just check $@ after eval expression.