Michael G Schwern wrote:
> Test::More 0.71 fixed a subtle bug where a call to use_ok() inside a BEGIN
> block without a plan would be silently ignored.  That is...
>
>       use Test::More;
>
>       BEGIN { use_ok('Exporter') }  # for example
>
>       plan tests => 1;
>       pass();
>
> would pass when it should have failed.  This commonly takes the form...
>
>       use Test::More;
>
>       if( ...something we need isn't there... ) {
>               plan skip_all => "Missing something";
>       }
>       else {
>               plan tests => 2;
>       }
>
>       BEGIN { use_ok('Some::Module') }
>
>   

XML::LibXML does this.  Attached is a patch to fix it.

Regards,
Jonathan Rockway



--- t/40reader-BROKEN.t	2007-09-15 22:31:56.000000000 -0500
+++ t/40reader-FIXED.t	2007-09-15 22:34:45.000000000 -0500
@@ -3,13 +3,15 @@
 use warnings;
 use Test::More;
 
-if (XML::LibXML::LIBXML_VERSION() >= 20621) {
-   plan tests => 92;
-} else {
-   plan skip_all => "Reader not supported for libxml2 <= 2.6.20";
-}
+use XML::LibXML;
 
 BEGIN{
+  if (XML::LibXML::LIBXML_VERSION() >= 20621) {
+     plan tests => 93;
+  } else {
+     plan skip_all => "Reader not supported for libxml2 <= 2.6.20";
+  }
+
   use_ok('XML::LibXML::Reader');
 };
 

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to