On Thu Jan 29 14:54:52 2015, JLMARTIN wrote:
Show quoted text> Hi,
>
> This test script will not pass:
>
> use Test::Exception;
>
> lives_ok { 1 + 1 } 'This guy lives OK';
>
> done_testing;
>
> user@host:~$ perl t_exception.t
> ok 1 - This guy lives OK
> # Tests were run but no plan was declared and done_testing() was not
> seen.
>
> To correct this situation, you have to "use Test::More". It's strange,
> since it seemd that you can use Test::Exception "standalone", without
> using Test::More
>
> Best Regards,
>
> Jose Luis Martinez
In order to fix this Test::Exception would have to export done_testing and the other Test::More subs. Test::Exception is not allowed to do this though as it is often used with Test::More. In addition you would probably get a better error message if you used strict/warnings in that sample.
$ perl -e 'use Test::Exception; lives_ok { 1 + 1 } "lived"; done_testing'
ok 1 - lived
# Tests were run but no plan was declared and done_testing() was not seen.
$ perl -e 'use strict; use warnings; use Test::Exception; lives_ok { 1 + 1 } "lived"; done_testing'
Bareword "done_testing" not allowed while "strict subs" in use at -e line 1.
Execution of -e aborted due to compilation errors.