Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

petdance (2468)

AOL IM: petdance (Add Buddy, Send Message)
Yahoo! ID: petdance (Add User, Send Message)

I'm Andy Lester, and I like to test stuff. I also write for the Perl Journal, and do tech edits on books. Sometimes I write code, too.

Journal of petdance (2468)

Thursday June 19, 2003
09:58 AM

More helpful module tests

[ #12950 ]
I hate releasing things where I've accidentally left XXXed code to look at later. So, I made a t/98.rules.t that fails if I've forgotten any XXXes in my files:

use Test::More tests => 2;
use File::Spec;
use strict;

my $file = File::Spec->catfile( qw( lib WWW ), "" );
source_file_ok( $file );

$file = File::Spec->catfile( qw( lib WWW Mechanize ), "Examples.pod" );
source_file_ok( $file );

sub source_file_ok {
    my $file = shift;

    open( my $fh, "<", $file ) or die "Can't open $file: $!";
    my @lines = <$fh>;
    close $fh;

    my $n = 0;
    for ( @lines ) {
        s/^/$file ($n): /;

    my @x = grep /XXX/, @lines;

    if ( !is( scalar @x, 0, "Looking for XXXes" ) ) {
        diag( $_ ) for @x;

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.