On 7/19/06, Gabor Szabo <[EMAIL PROTECTED]> wrote:
> Its not Test::More's job to enforce style.  The more things are
> optional the more useful to more people it is.

What about someone creating a module  Test::HaveNames or similar that
if added to a test file will add a last test being ok only if all the tests
had some name.

There could be also a Test::HaveUniqNames checking - in addition to the
existance of test names also uniqueness.

Here, I'll even write the prototype for you if it will end this conversation.

#!/usr/bin/perl -w

use Test::Builder;
use Hook::LexWrap;

my @No_Names;
wrap 'Test::Builder::ok',
   post => sub {
       my($self, $ok, $name) = @_;
       local $Test::Builder::Level = $Test::Builder::Level + 1;
       push @No_Names, [$self->caller] unless defined $_[2];
   };

use Test::More tests => 3;

is( 2, 2, 'foo' );
is( 'foo', 'foo' );

END {
   ok( [EMAIL PROTECTED], "Some tests have no names" );
   for my $no_name (@No_Names) {
       diag sprintf "Test in %s at line %d has no name", @{$no_name}[1,2];
   }
}

Reply via email to