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

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

Thread Next
From:
Michael G Schwern
Date:
September 15, 2007 05:22
Subject:
Bug fix in Test::More 0.71 may reveal failures tests
Message ID:
46EBCAA9.5020501@pobox.com
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.


-- 
Stabbing you in the face so you don't have to.


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