in reply to Re: Re: testing code
in thread testing code

We use Test::More all the time.

Every <module>.t we write has a corresponding t/<module>.t test file written for it.

I've included a real Makefile.PL from one of our projects, and a sample Test::More template .t file.

You should also read the ExtUtils::MakeMaker doco for more sophisticated ways of calling make test

# Makefile.PL use ExtUtils::MakeMaker; WriteMakefile( NAME => 'txu_bims', VERSION_FROM => 'VERSION.pm', test => {TESTS => './TXU/BIMS/t/*.t ./TXU/t/*.t' +}, # how to pass multiple test paths PMLIBDIRS => ['./TXU/BIMS', './TXU'], PREREQ_PM => { Log::Log4perl => 0.36, }, );
# template Module/Under/t/Test.t #!/usr/bin/perl -w use strict; use Test::More qw(no_plan); use Module::Under::Test; # test go here my $obj = Module::Under::Test->new(); isa_ok($obj, 'Module::Under::Test'); is($obj->method(), 'expected output', 'standard test'); is_deeply($obj->meth_retn_ref(), {complex => {structure => ['here']}}, + 'method returns ref to complex structure');

After this, its as simple as ...

perl Makefile.PL make test

More complex examples of calling make test are ...

*UPDATE* - proxy dropped out half way through uploading this - added the point list

+++++++++++++++++
#!/usr/bin/perl
use warnings;use strict;use brain;