develooper Front page | perl.qa | Postings from September 2007

Re: Bug fix in Test::More 0.71 may reveal failures tests

Thread Previous | Thread Next
From:
A. Pagaltzis
Date:
September 17, 2007 04:03
Subject:
Re: Bug fix in Test::More 0.71 may reveal failures tests
Message ID:
20070917105522.GN11876@klangraum
* Michael G Schwern <schwern@pobox.com> [2007-09-15 16:05]:
> 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') }
> 
> Even though the use_ok() comes after the plan() in the code, it
> gets run before because of the BEGIN block.  If your code does
> the above, it won't work anymore.
> 
> This has already effected two modules, and one of them is DBI.

Let’s see…

http://www.google.com/codesearch?q=lang%3Aperl+%22use+Test%3A%3AMore%3B%22+%22BEGIN+%7B+use_ok%22

About 170 hits after dupes; most of the hits are bogus, but about
40 are bullseyes. Confirmed kills:

• AIX::Perfstat (disk.t)
• Business::BR::Ids (002_cpf_test.t 015_pis_test.t)
• Cache::FastMmap (6.t)
• CGI::Application::Plugin::LogDispatch (singleton.t)
• CGI::Application::Plugin::TT (04_singleton.t)
• CGI::Uploader (up_table_map.t)
• Data::FormValidator::FromDBI (01-generator.t)
• Date::Span (from_unit.t)
• DBD::Sybase (place.t)
• DBIx::AsForm (basic.t)
• DBIx::LazyMethod (MySQL.t)
• DBIx::Simple (sqlite.t)
• DTS (AssignmentTypes.t)
• Gaim::Log::Parser (002DateTime.t)
• HTML::DBTable (02__DBSchemaPatched.t)
• HTML::TableParser (contents.t)
• Image::MetaData::JPEG (JPEG_0_records.t JPEG_1_segments.t JPEG_2_JPEG_class.t)
• jsFind (04words.t)
• Mail::Audit (shorthand.t)
• Mail::SpamAssassin::SimpleClient (result-spam.t)
• Mail::Toaster (maillogs.t)
• Net::FTPSSL (10-complex.t)
• Oracle::Debug (oradb.t)
• POE::Component::SNMP (20_snmp_getnext.t 60_errors.t)
• Purple (api.t)
• RDF::Sesame (98-debug.t)
• sapnwrfc (06test_data_z.t 08deep_z.t)
• Search::Estraier (5_Node.t)
• Solaris::Disk::Mnttab (05half-calls.t)
• Solaris::Disk::VTOC (15size2.t)
• SVN::Notify (html.t)
• Test::MinimumVersion (pod-coverage.t)
• Text::Aspell (05-core.t)
• Text::Capitalize (003-captitle-preserve_whitespace.t)
• Tuxedo::Admin (1.t)
• WWW::Ofoto (14-upload_lots.t)

I’ve added the authors of those modules to To: on this mail.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About