#!/usr/bin/perl -wT use strict; use File::Spec; use File::Find; use Test::More; use constant DISTRIBUTION => 'TAP::Parser'; # Set this to true if all packages have the same version number use constant CHECK_VERSION => 1; sub file_to_pm { my ( $dir, $file ) = @_; $file =~ s/\.pm$// || return; # we only care about .pm files $file =~ s{\\}{/}g; # to make win32 happy $dir =~ s{\\}{/}g; # to make win32 happy $file =~ s/^$dir//; my $_package = join '::' => grep $_ => File::Spec->splitdir($file) +; # untaint that puppy! my ($package) = $_package =~ /^([\w]+(?:::[\w]+)*)$/; return DISTRIBUTION eq $package ? () : $package; } BEGIN { my $dir = 'lib'; my @classes; find( { no_chdir => 1, # keeps it taint safe wanted => sub { -f && /\.pm$/ && push @classes => file_to_pm( $dir, $File::Find::n +ame ); } }, $dir, ); my $tests_per_class = CHECK_VERSION ? 2 : 1; plan tests => $tests_per_class + $tests_per_class * @classes; foreach my $class ( DISTRIBUTION, sort @classes ) { use_ok $class or BAIL_OUT("Could not load $class"); if (CHECK_VERSION) { is $class->VERSION, DISTRIBUTION->VERSION, "... and $class should have the correct version"; } } diag("Testing Test::Harness $Test::Harness::VERSION, Perl $], $^X" +); }

In reply to A Better 't/00-load.t' by Ovid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.