Test::Exception::LessClever(3pm) | User Contributed Perl Documentation | Test::Exception::LessClever(3pm) |
Test::Exception::LessClever - (DEPRECATED) Test::Exception simplified
*** This module is deprecated: please do not use it! ***
An alternative to Test::Exception that is much simpler. This alternative does not use fancy stack tricks to hide itself. The idea here is to keep it simple. This also solves the Test::Exception bug where some dies will be hidden when a DESTROY method calls eval. If a DESTROY method masks $@ a warning will be generated as well.
Here is an IRC log.
<Exodist> wtf? Bizarre copy of HASH in sassign at /usr/lib64/perl5/5.10.1/Carp/Heavy.pm line 104 <Exodist> hmm, it doesn't happen when I step through the debugger, that sure is helpful yessir <Exodist> hmm, throws_ok or dies_ok { stuff that croaks in a package used by the one being tested }, at least in this case causes that error. If I change it to eval {}; ok( $@ ); like( $@, qr// ); it works fine <Exodist> Ah-Ha, earlier when I mentioned I stopped using throws_ok because of something I could not remember, this was it, I stumbled on it again! <confound> probably because throws_ok tries to do clever things to fiddle with the call stack to make it appear as though its guts are not being called <confound> less clever would be more useful
Pretty much a clone of Test::Exception Refer to those docs for more details.
use Test::More; use Test::Exception; dies_ok { die( 'xxx' )} "Should die"; lives_ok { 1 } "Should live"; throws_ok { die( 'xxx' )} qr/xxx/, "Throws 'xxx'"; lives_and { ok( 1, "We did not die" )} "Ooops we died"; done_testing;
Will generate a warning if the test dies, $@ is empty AND called in array context. This usually occurs when an objects DESTROY method calls eval and masks $@.
*NOT EXPORTED BY DEFAULT*
Test fails is the sub does not die, or if the message does not match the regex.
Chad Granum exodist7@gmail.com
Copyright (C) 2010 Chad Granum
Test-Exception-LessClever is free software; Standard perl licence.
Test-Exception-LessClever is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
2022-10-16 | perl v5.34.0 |