testing
Jonathan Stowe
jns at integration-house.com
Mon Nov 3 13:57:01 GMT 2008
2008/11/3 Christopher Jones <c.jones at ucl.ac.uk>:
> Should you be able to create and call methods from a package in a test
> script? i.e Should something like this work? (i.e.i.e. it doesn't seem to
> for me right now).
>
>
> #!/usr/bin/perl -w
> use strict;
>
> use Test::More tests => 2;
>
> BEGIN {
> use_ok('My::Module'); # contains a package called 'my_mod'
> };
> test 'object init' => sub {
> ok(my $object = my_test_mod->new(),'init');
> };
>
> { package my_test_mod;
> our @ISA = qw( my_mod );
> }
>
It is highly un-recommended to have have a module file which contains
a differently named package. That is to say your "$LIB/My/Module.pm"
should contain the package "My::Module".
More information about the london.pm
mailing list