Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Test-Exception CPAN distribution.

Report information
The Basics
Id: 101831
Status: resolved
Priority: 0/
Queue: Test-Exception

People
Owner: Nobody in particular
Requestors: jlmartinez [...] capside.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.35
Fixed in: (no value)



Subject: "Tests run but no plan was declared" on a seemingly valid test
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
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.
I am closing this as not a bug. To use done_testing you need to use Test::More, there is no sane way to change that.