dslinux/user/perl/lib/Test Builder.pm Harness.pm More.pm Simple.pm Tutorial.pod

cayenne dslinux_cayenne at user.in-berlin.de
Mon Dec 4 18:01:03 CET 2006


Update of /cvsroot/dslinux/dslinux/user/perl/lib/Test
In directory antilope:/tmp/cvs-serv17422/lib/Test

Added Files:
	Builder.pm Harness.pm More.pm Simple.pm Tutorial.pod 
Log Message:
Adding fresh perl source to HEAD to branch from

--- NEW FILE: Simple.pm ---
package Test::Simple;

use 5.004;

use strict 'vars';
use vars qw($VERSION @ISA @EXPORT);
$VERSION = '0.62';
$VERSION = eval $VERSION;    # make the alpha version come out as a number

use Test::Builder::Module;
@ISA    = qw(Test::Builder::Module);
@EXPORT = qw(ok);

my $CLASS = __PACKAGE__;


=head1 NAME

Test::Simple - Basic utilities for writing tests.

=head1 SYNOPSIS

  use Test::Simple tests => 1;

  ok( $foo eq $bar, 'foo is bar' );


=head1 DESCRIPTION

** If you are unfamiliar with testing B<read Test::Tutorial> first! **

This is an extremely simple, extremely basic module for writing tests
suitable for CPAN modules and other pursuits.  If you wish to do more
complicated testing, use the Test::More module (a drop-in replacement
for this one).

The basic unit of Perl testing is the ok.  For each thing you want to
test your program will print out an "ok" or "not ok" to indicate pass
or fail.  You do this with the ok() function (see below).

The only other constraint is you must pre-declare how many tests you
plan to run.  This is in case something goes horribly wrong during the
test and your test program aborts, or skips a test or whatever.  You
do this like so:

    use Test::Simple tests => 23;

You must have a plan.


=over 4

=item B<ok>

  ok( $foo eq $bar, $name );
  ok( $foo eq $bar );

ok() is given an expression (in this case C<$foo eq $bar>).  If it's
true, the test passed.  If it's false, it didn't.  That's about it.

ok() prints out either "ok" or "not ok" along with a test number (it
keeps track of that for you).

  # This produces "ok 1 - Hell not yet frozen over" (or not ok)
  ok( get_temperature($hell) > 0, 'Hell not yet frozen over' );

If you provide a $name, that will be printed along with the "ok/not
ok" to make it easier to find your test when if fails (just search for
the name).  It also makes it easier for the next guy to understand
what your test is for.  It's highly recommended you use test names.

All tests are run in scalar context.  So this:

    ok( @stuff, 'I have some stuff' );

will do what you mean (fail if stuff is empty)

=cut

sub ok ($;$) {
    $CLASS->builder->ok(@_);
}


=back

Test::Simple will start by printing number of tests run in the form
"1..M" (so "1..5" means you're going to run 5 tests).  This strange
format lets Test::Harness know how many tests you plan on running in
case something goes horribly wrong.

If all your tests passed, Test::Simple will exit with zero (which is
normal).  If anything failed it will exit with how many failed.  If
you run less (or more) tests than you planned, the missing (or extras)
will be considered failures.  If no tests were ever run Test::Simple
will throw a warning and exit with 255.  If the test died, even after
having successfully completed all its tests, it will still be
considered a failure and will exit with 255.

So the exit codes are...

    0                   all tests successful
    255                 test died or all passed but wrong # of tests run
    any other number    how many failed (including missing or extras)

If you fail more than 254 tests, it will be reported as 254.

This module is by no means trying to be a complete testing system.
It's just to get you started.  Once you're off the ground its
recommended you look at L<Test::More>.


=head1 EXAMPLE

Here's an example of a simple .t file for the fictional Film module.

    use Test::Simple tests => 5;

    use Film;  # What you're testing.

    my $btaste = Film->new({ Title    => 'Bad Taste',
                             Director => 'Peter Jackson',
                             Rating   => 'R',
                             NumExplodingSheep => 1
                           });
    ok( defined($btaste) && ref $btaste eq 'Film,     'new() works' );

    ok( $btaste->Title      eq 'Bad Taste',     'Title() get'    );
    ok( $btaste->Director   eq 'Peter Jackson', 'Director() get' );
    ok( $btaste->Rating     eq 'R',             'Rating() get'   );
    ok( $btaste->NumExplodingSheep == 1,        'NumExplodingSheep() get' );

It will produce output like this:

    1..5
    ok 1 - new() works
    ok 2 - Title() get
    ok 3 - Director() get
    not ok 4 - Rating() get
    #   Failed test 'Rating() get'
    #   in t/film.t at line 14.
    ok 5 - NumExplodingSheep() get
    # Looks like you failed 1 tests of 5

Indicating the Film::Rating() method is broken.


=head1 CAVEATS

Test::Simple will only report a maximum of 254 failures in its exit
code.  If this is a problem, you probably have a huge test script.
Split it into multiple files.  (Otherwise blame the Unix folks for
using an unsigned short integer as the exit status).

Because VMS's exit codes are much, much different than the rest of the
universe, and perl does horrible mangling to them that gets in my way,
it works like this on VMS.

    0     SS$_NORMAL        all tests successful
    4     SS$_ABORT         something went wrong

Unfortunately, I can't differentiate any further.


=head1 NOTES

Test::Simple is B<explicitly> tested all the way back to perl 5.004.

Test::Simple is thread-safe in perl 5.8.0 and up.

=head1 HISTORY

This module was conceived while talking with Tony Bowden in his
kitchen one night about the problems I was having writing some really
complicated feature into the new Testing module.  He observed that the
main problem is not dealing with these edge cases but that people hate
to write tests B<at all>.  What was needed was a dead simple module
that took all the hard work out of testing and was really, really easy
to learn.  Paul Johnson simultaneously had this idea (unfortunately,
he wasn't in Tony's kitchen).  This is it.


=head1 SEE ALSO

=over 4

=item L<Test::More>

More testing functions!  Once you outgrow Test::Simple, look at
Test::More.  Test::Simple is 100% forward compatible with Test::More
(i.e. you can just use Test::More instead of Test::Simple in your
programs and things will still work).

=item L<Test>

The original Perl testing module.

=item L<Test::Unit>

Elaborate unit testing.

=item L<Test::Inline>, L<SelfTest>

Embed tests in your code!

=item L<Test::Harness>

Interprets the output of your test program.

=back


=head1 AUTHORS

Idea by Tony Bowden and Paul Johnson, code by Michael G Schwern
E<lt>schwern at pobox.comE<gt>, wardrobe by Calvin Klein.


=head1 COPYRIGHT

Copyright 2001, 2002, 2004 by Michael G Schwern E<lt>schwern at pobox.comE<gt>.

This program is free software; you can redistribute it and/or 
modify it under the same terms as Perl itself.

See F<http://www.perl.com/perl/misc/Artistic.html>

=cut

1;

--- NEW FILE: Tutorial.pod ---
=head1 NAME

Test::Tutorial - A tutorial about writing really basic tests

=head1 DESCRIPTION


I<AHHHHHHH!!!!  NOT TESTING!  Anything but testing!  
Beat me, whip me, send me to Detroit, but don't make 
me write tests!>

I<*sob*>

I<Besides, I don't know how to write the damned things.>


Is this you?  Is writing tests right up there with writing
documentation and having your fingernails pulled out?  Did you open up
a test and read 

    ######## We start with some black magic

and decide that's quite enough for you?

It's ok.  That's all gone now.  We've done all the black magic for
you.  And here are the tricks...


=head2 Nuts and bolts of testing.

Here's the most basic test program.

    #!/usr/bin/perl -w

    print "1..1\n";

    print 1 + 1 == 2 ? "ok 1\n" : "not ok 1\n";

since 1 + 1 is 2, it prints:

    1..1
    ok 1

What this says is: C<1..1> "I'm going to run one test." [1] C<ok 1>
"The first test passed".  And that's about all magic there is to
testing.  Your basic unit of testing is the I<ok>.  For each thing you
test, an C<ok> is printed.  Simple.  B<Test::Harness> interprets your test
results to determine if you succeeded or failed (more on that later).

Writing all these print statements rapidly gets tedious.  Fortunately,
there's B<Test::Simple>.  It has one function, C<ok()>.

    #!/usr/bin/perl -w

    use Test::Simple tests => 1;

    ok( 1 + 1 == 2 );

and that does the same thing as the code above.  C<ok()> is the backbone
of Perl testing, and we'll be using it instead of roll-your-own from
here on.  If C<ok()> gets a true value, the test passes.  False, it
fails.

    #!/usr/bin/perl -w

    use Test::Simple tests => 2;
    ok( 1 + 1 == 2 );
    ok( 2 + 2 == 5 );

from that comes

    1..2
    ok 1
    not ok 2
    #     Failed test (test.pl at line 5)
    # Looks like you failed 1 tests of 2.

C<1..2> "I'm going to run two tests."  This number is used to ensure
your test program ran all the way through and didn't die or skip some
tests.  C<ok 1> "The first test passed."  C<not ok 2> "The second test
failed".  Test::Simple helpfully prints out some extra commentary about
your tests.

It's not scary.  Come, hold my hand.  We're going to give an example
of testing a module.  For our example, we'll be testing a date
library, B<Date::ICal>.  It's on CPAN, so download a copy and follow
along. [2]


=head2 Where to start?

This is the hardest part of testing, where do you start?  People often
get overwhelmed at the apparent enormity of the task of testing a
whole module.  Best place to start is at the beginning.  Date::ICal is
an object-oriented module, and that means you start by making an
object.  So we test C<new()>.

    #!/usr/bin/perl -w

    use Test::Simple tests => 2;

    use Date::ICal;

    my $ical = Date::ICal->new;         # create an object
    ok( defined $ical );                # check that we got something
    ok( $ical->isa('Date::ICal') );     # and it's the right class

run that and you should get:

    1..2
    ok 1
    ok 2

congratulations, you've written your first useful test.


=head2 Names

That output isn't terribly descriptive, is it?  When you have two
tests you can figure out which one is #2, but what if you have 102?

Each test can be given a little descriptive name as the second
argument to C<ok()>.

    use Test::Simple tests => 2;

    ok( defined $ical,              'new() returned something' );
    ok( $ical->isa('Date::ICal'),   "  and it's the right class" );

So now you'd see...

    1..2
    ok 1 - new() returned something
    ok 2 -   and it's the right class


=head2 Test the manual

Simplest way to build up a decent testing suite is to just test what
the manual says it does. [3] Let's pull something out of the 
L<Date::ICal/SYNOPSIS> and test that all its bits work.

    #!/usr/bin/perl -w

    use Test::Simple tests => 8;

    use Date::ICal;

    $ical = Date::ICal->new( year => 1964, month => 10, day => 16, 
                             hour => 16, min => 12, sec => 47, 
                             tz => '0530' );

    ok( defined $ical,            'new() returned something' );
    ok( $ical->isa('Date::ICal'), "  and it's the right class" );
    ok( $ical->sec   == 47,       '  sec()'   );
    ok( $ical->min   == 12,       '  min()'   );    
    ok( $ical->hour  == 16,       '  hour()'  );
    ok( $ical->day   == 17,       '  day()'   );
    ok( $ical->month == 10,       '  month()' );
    ok( $ical->year  == 1964,     '  year()'  );

run that and you get:

    1..8
    ok 1 - new() returned something
    ok 2 -   and it's the right class
    ok 3 -   sec()
    ok 4 -   min()
    ok 5 -   hour()
    not ok 6 -   day()
    #     Failed test (- at line 16)
    ok 7 -   month()
    ok 8 -   year()
    # Looks like you failed 1 tests of 8.

Whoops, a failure! [4] Test::Simple helpfully lets us know on what line
the failure occurred, but not much else.  We were supposed to get 17,
but we didn't.  What did we get??  Dunno.  We'll have to re-run the
test in the debugger or throw in some print statements to find out.

Instead, we'll switch from B<Test::Simple> to B<Test::More>.  B<Test::More>
does everything B<Test::Simple> does, and more!  In fact, Test::More does
things I<exactly> the way Test::Simple does.  You can literally swap
Test::Simple out and put Test::More in its place.  That's just what
we're going to do.

Test::More does more than Test::Simple.  The most important difference
at this point is it provides more informative ways to say "ok".
Although you can write almost any test with a generic C<ok()>, it
can't tell you what went wrong.  Instead, we'll use the C<is()>
function, which lets us declare that something is supposed to be the
same as something else:

    #!/usr/bin/perl -w

    use Test::More tests => 8;

    use Date::ICal;

    $ical = Date::ICal->new( year => 1964, month => 10, day => 16, 
                             hour => 16, min => 12, sec => 47, 
                             tz => '0530' );

    ok( defined $ical,            'new() returned something' );
    ok( $ical->isa('Date::ICal'), "  and it's the right class" );
    is( $ical->sec,     47,       '  sec()'   );
    is( $ical->min,     12,       '  min()'   );    
    is( $ical->hour,    16,       '  hour()'  );
    is( $ical->day,     17,       '  day()'   );
    is( $ical->month,   10,       '  month()' );
    is( $ical->year,    1964,     '  year()'  );

"Is C<$ical-E<gt>sec> 47?"  "Is C<$ical-E<gt>min> 12?"  With C<is()> in place,
you get some more information

    1..8
    ok 1 - new() returned something
    ok 2 -   and it's the right class
    ok 3 -   sec()
    ok 4 -   min()
    ok 5 -   hour()
    not ok 6 -   day()
    #     Failed test (- at line 16)
    #          got: '16'
    #     expected: '17'
    ok 7 -   month()
    ok 8 -   year()
    # Looks like you failed 1 tests of 8.

letting us know that C<$ical-E<gt>day> returned 16, but we expected 17.  A
quick check shows that the code is working fine, we made a mistake
when writing up the tests.  Just change it to:

    is( $ical->day,     16,       '  day()'   );

and everything works.

So any time you're doing a "this equals that" sort of test, use C<is()>.
It even works on arrays.  The test is always in scalar context, so you
can test how many elements are in a list this way. [5]

    is( @foo, 5, 'foo has 5 elements' );


=head2 Sometimes the tests are wrong

Which brings us to a very important lesson.  Code has bugs.  Tests are
code.  Ergo, tests have bugs.  A failing test could mean a bug in the
code, but don't discount the possibility that the test is wrong.

On the flip side, don't be tempted to prematurely declare a test
incorrect just because you're having trouble finding the bug.
Invalidating a test isn't something to be taken lightly, and don't use
it as a cop out to avoid work.


=head2 Testing lots of values

We're going to be wanting to test a lot of dates here, trying to trick
the code with lots of different edge cases.  Does it work before 1970?
After 2038?  Before 1904?  Do years after 10,000 give it trouble?
Does it get leap years right?  We could keep repeating the code above,
or we could set up a little try/expect loop.

    use Test::More tests => 32;
    use Date::ICal;

    my %ICal_Dates = (
            # An ICal string     And the year, month, date
            #                    hour, minute and second we expect.
            '19971024T120000' =>    # from the docs.
                                [ 1997, 10, 24, 12,  0,  0 ],
            '20390123T232832' =>    # after the Unix epoch
                                [ 2039,  1, 23, 23, 28, 32 ],
            '19671225T000000' =>    # before the Unix epoch
                                [ 1967, 12, 25,  0,  0,  0 ],
            '18990505T232323' =>    # before the MacOS epoch
                                [ 1899,  5,  5, 23, 23, 23 ],
    );


    while( my($ical_str, $expect) = each %ICal_Dates ) {
        my $ical = Date::ICal->new( ical => $ical_str );

        ok( defined $ical,            "new(ical => '$ical_str')" );
        ok( $ical->isa('Date::ICal'), "  and it's the right class" );

        is( $ical->year,    $expect->[0],     '  year()'  );
        is( $ical->month,   $expect->[1],     '  month()' );
        is( $ical->day,     $expect->[2],     '  day()'   );
        is( $ical->hour,    $expect->[3],     '  hour()'  );
        is( $ical->min,     $expect->[4],     '  min()'   );    
        is( $ical->sec,     $expect->[5],     '  sec()'   );
    }

So now we can test bunches of dates by just adding them to
C<%ICal_Dates>.  Now that it's less work to test with more dates, you'll
be inclined to just throw more in as you think of them.
Only problem is, every time we add to that we have to keep adjusting
the C<use Test::More tests =E<gt> ##> line.  That can rapidly get
annoying.  There's two ways to make this work better.

First, we can calculate the plan dynamically using the C<plan()>
function.

    use Test::More;
    use Date::ICal;

    my %ICal_Dates = (
        ...same as before...
    );

    # For each key in the hash we're running 8 tests.
    plan tests => keys %ICal_Dates * 8;

Or to be even more flexible, we use C<no_plan>.  This means we're just
running some tests, don't know how many. [6]

    use Test::More 'no_plan';   # instead of tests => 32

now we can just add tests and not have to do all sorts of math to
figure out how many we're running.


=head2 Informative names

Take a look at this line here

    ok( defined $ical,            "new(ical => '$ical_str')" );

we've added more detail about what we're testing and the ICal string
itself we're trying out to the name.  So you get results like:

    ok 25 - new(ical => '19971024T120000')
    ok 26 -   and it's the right class
    ok 27 -   year()
    ok 28 -   month()
    ok 29 -   day()
    ok 30 -   hour()
    ok 31 -   min()
    ok 32 -   sec()

if something in there fails, you'll know which one it was and that
will make tracking down the problem easier.  So try to put a bit of
debugging information into the test names.

Describe what the tests test, to make debugging a failed test easier
for you or for the next person who runs your test.


=head2 Skipping tests

Poking around in the existing Date::ICal tests, I found this in
F<t/01sanity.t> [7]

    #!/usr/bin/perl -w

    use Test::More tests => 7;
    use Date::ICal;

    # Make sure epoch time is being handled sanely.
    my $t1 = Date::ICal->new( epoch => 0 );
    is( $t1->epoch, 0,          "Epoch time of 0" );

    # XXX This will only work on unix systems.
    is( $t1->ical, '19700101Z', "  epoch to ical" );

    is( $t1->year,  1970,       "  year()"  );
    is( $t1->month, 1,          "  month()" );
    is( $t1->day,   1,          "  day()"   );

    # like the tests above, but starting with ical instead of epoch
    my $t2 = Date::ICal->new( ical => '19700101Z' );
    is( $t2->ical, '19700101Z', "Start of epoch in ICal notation" );

    is( $t2->epoch, 0,          "  and back to ICal" );

The beginning of the epoch is different on most non-Unix operating
systems [8].  Even though Perl smooths out the differences for the most
part, certain ports do it differently.  MacPerl is one off the top of
my head. [9] We I<know> this will never work on MacOS.  So rather than
just putting a comment in the test, we can explicitly say it's never
going to work and skip the test.

    use Test::More tests => 7;
    use Date::ICal;

    # Make sure epoch time is being handled sanely.
    my $t1 = Date::ICal->new( epoch => 0 );
    is( $t1->epoch, 0,          "Epoch time of 0" );

    SKIP: {
        skip('epoch to ICal not working on MacOS', 6) 
            if $^O eq 'MacOS';

        is( $t1->ical, '19700101Z', "  epoch to ical" );

        is( $t1->year,  1970,       "  year()"  );
        is( $t1->month, 1,          "  month()" );
        is( $t1->day,   1,          "  day()"   );

        # like the tests above, but starting with ical instead of epoch
        my $t2 = Date::ICal->new( ical => '19700101Z' );
        is( $t2->ical, '19700101Z', "Start of epoch in ICal notation" );

        is( $t2->epoch, 0,          "  and back to ICal" );
    }

A little bit of magic happens here.  When running on anything but
MacOS, all the tests run normally.  But when on MacOS, C<skip()> causes
the entire contents of the SKIP block to be jumped over.  It's never
run.  Instead, it prints special output that tells Test::Harness that
the tests have been skipped.

    1..7
    ok 1 - Epoch time of 0
    ok 2 # skip epoch to ICal not working on MacOS
    ok 3 # skip epoch to ICal not working on MacOS
    ok 4 # skip epoch to ICal not working on MacOS
    ok 5 # skip epoch to ICal not working on MacOS
    ok 6 # skip epoch to ICal not working on MacOS
    ok 7 # skip epoch to ICal not working on MacOS

This means your tests won't fail on MacOS.  This means less emails
from MacPerl users telling you about failing tests that you know will
never work.  You've got to be careful with skip tests.  These are for
tests which don't work and I<never will>.  It is not for skipping
genuine bugs (we'll get to that in a moment).

The tests are wholly and completely skipped. [10]  This will work.

    SKIP: {
        skip("I don't wanna die!");

        die, die, die, die, die;
    }


=head2 Todo tests

Thumbing through the Date::ICal man page, I came across this:

   ical

       $ical_string = $ical->ical;

   Retrieves, or sets, the date on the object, using any
   valid ICal date/time string.

"Retrieves or sets".  Hmmm, didn't see a test for using C<ical()> to set
the date in the Date::ICal test suite.  So I'll write one.

    use Test::More tests => 1;
    use Date::ICal;

    my $ical = Date::ICal->new;
    $ical->ical('20201231Z');
    is( $ical->ical, '20201231Z',   'Setting via ical()' );

run that and I get

    1..1
    not ok 1 - Setting via ical()
    #     Failed test (- at line 6)
    #          got: '20010814T233649Z'
    #     expected: '20201231Z'
    # Looks like you failed 1 tests of 1.

Whoops!  Looks like it's unimplemented.  Let's assume we don't have
the time to fix this. [11] Normally, you'd just comment out the test
and put a note in a todo list somewhere.  Instead, we're going to
explicitly state "this test will fail" by wrapping it in a C<TODO> block.

    use Test::More tests => 1;

    TODO: {
        local $TODO = 'ical($ical) not yet implemented';

        my $ical = Date::ICal->new;
        $ical->ical('20201231Z');

        is( $ical->ical, '20201231Z',   'Setting via ical()' );
    }

Now when you run, it's a little different:

    1..1
    not ok 1 - Setting via ical() # TODO ical($ical) not yet implemented
    #          got: '20010822T201551Z'
    #     expected: '20201231Z'

Test::More doesn't say "Looks like you failed 1 tests of 1".  That '#
TODO' tells Test::Harness "this is supposed to fail" and it treats a
failure as a successful test.  So you can write tests even before
you've fixed the underlying code.

If a TODO test passes, Test::Harness will report it "UNEXPECTEDLY
SUCCEEDED".  When that happens, you simply remove the TODO block with
C<local $TODO> and turn it into a real test.


=head2 Testing with taint mode.

Taint mode is a funny thing.  It's the globalest of all global
features.  Once you turn it on, it affects I<all> code in your program
and I<all> modules used (and all the modules they use).  If a single
piece of code isn't taint clean, the whole thing explodes.  With that
in mind, it's very important to ensure your module works under taint
mode.

It's very simple to have your tests run under taint mode.  Just throw
a C<-T> into the C<#!> line.  Test::Harness will read the switches
in C<#!> and use them to run your tests.

    #!/usr/bin/perl -Tw

    ...test normally here...

So when you say C<make test> it will be run with taint mode and
warnings on.


=head1 FOOTNOTES

=over 4

=item 1

The first number doesn't really mean anything, but it has to be 1.
It's the second number that's important.

=item 2

For those following along at home, I'm using version 1.31.  It has
some bugs, which is good -- we'll uncover them with our tests.

=item 3

You can actually take this one step further and test the manual
itself.  Have a look at B<Test::Inline> (formerly B<Pod::Tests>).

=item 4

Yes, there's a mistake in the test suite.  What!  Me, contrived?

=item 5

We'll get to testing the contents of lists later.

=item 6

But what happens if your test program dies halfway through?!  Since we
didn't say how many tests we're going to run, how can we know it
failed?  No problem, Test::More employs some magic to catch that death
and turn the test into a failure, even if every test passed up to that
point.

=item 7

I cleaned it up a little.

=item 8

Most Operating Systems record time as the number of seconds since a
certain date.  This date is the beginning of the epoch.  Unix's starts
at midnight January 1st, 1970 GMT.

=item 9

MacOS's epoch is midnight January 1st, 1904.  VMS's is midnight,
November 17th, 1858, but vmsperl emulates the Unix epoch so it's not a
problem.

=item 10

As long as the code inside the SKIP block at least compiles.  Please
don't ask how.  No, it's not a filter.

=item 11

Do NOT be tempted to use TODO tests as a way to avoid fixing simple
bugs!

=back

=head1 AUTHORS

Michael G Schwern E<lt>schwern at pobox.comE<gt> and the perl-qa dancers!

=head1 COPYRIGHT

Copyright 2001 by Michael G Schwern E<lt>schwern at pobox.comE<gt>.

This documentation is free; you can redistribute it and/or modify it
under the same terms as Perl itself.

Irrespective of its distribution, all code examples in these files
are hereby placed into the public domain.  You are permitted and
encouraged to use this code in your own programs for fun
or for profit as you see fit.  A simple comment in the code giving
credit would be courteous but is not required.

=cut

--- NEW FILE: More.pm ---
package Test::More;

use 5.004;

use strict;


# Can't use Carp because it might cause use_ok() to accidentally succeed
# even though the module being used forgot to use Carp.  Yes, this
# actually happened.
sub _carp {
    my($file, $line) = (caller(1))[1,2];
    warn @_, " at $file line $line\n";
}



use vars qw($VERSION @ISA @EXPORT %EXPORT_TAGS $TODO);
$VERSION = '0.62';
[...1497 lines suppressed...]
the perl-qa gang.


=head1 BUGS

See F<http://rt.cpan.org> to report and view bugs.


=head1 COPYRIGHT

Copyright 2001, 2002, 2004 by Michael G Schwern E<lt>schwern at pobox.comE<gt>.

This program is free software; you can redistribute it and/or 
modify it under the same terms as Perl itself.

See F<http://www.perl.com/perl/misc/Artistic.html>

=cut

1;

--- NEW FILE: Builder.pm ---
package Test::Builder;

use 5.004;

# $^C was only introduced in 5.005-ish.  We do this to prevent
# use of uninitialized value warnings in older perls.
$^C ||= 0;

use strict;
use vars qw($VERSION);
$VERSION = '0.32';
$VERSION = eval $VERSION;    # make the alpha version come out as a number

# Make Test::Builder thread-safe for ithreads.
BEGIN {
    use Config;
    # Load threads::shared when threads are turned on
    if( $] >= 5.008 && $Config{useithreads} && $INC{'threads.pm'}) {
        require threads::shared;
[...1710 lines suppressed...]
Test::Simple, Test::More, Test::Harness

=head1 AUTHORS

Original code by chromatic, maintained by Michael G Schwern
E<lt>schwern at pobox.comE<gt>

=head1 COPYRIGHT

Copyright 2002, 2004 by chromatic E<lt>chromatic at wgz.orgE<gt> and
                        Michael G Schwern E<lt>schwern at pobox.comE<gt>.

This program is free software; you can redistribute it and/or 
modify it under the same terms as Perl itself.

See F<http://www.perl.com/perl/misc/Artistic.html>

=cut

1;

--- NEW FILE: Harness.pm ---
# -*- Mode: cperl; cperl-indent-level: 4 -*-

package Test::Harness;

require 5.00405;
use Test::Harness::Straps;
use Test::Harness::Assert;
use Exporter;
use Benchmark;
use Config;
use strict;


use vars qw(
    $VERSION 
    @ISA @EXPORT @EXPORT_OK 
    $Verbose $Switches $Debug
    $verbose $switches $debug
    $Curtest
[...1041 lines suppressed...]
Either Tim Bunce or Andreas Koenig, we don't know. What we know for
sure is, that it was inspired by Larry Wall's TEST script that came
with perl distributions for ages. Numerous anonymous contributors
exist.  Andreas Koenig held the torch for many years, and then
Michael G Schwern.

Current maintainer is Andy Lester C<< <andy at petdance.com> >>.

=head1 COPYRIGHT

Copyright 2002-2005
by Michael G Schwern C<< <schwern at pobox.com> >>,
Andy Lester C<< <andy at petdance.com> >>.

This program is free software; you can redistribute it and/or 
modify it under the same terms as Perl itself.

See L<http://www.perl.com/perl/misc/Artistic.html>.

=cut




More information about the dslinux-commit mailing list