B
Bill
To help with my unit tests (using Test::More), I created a helper
function 'eq_arrayref_and_file', that basically takes an array
reference and compares it to the contents of a static flie. This makes
it easy to test the output of a function by doing something like:
my @results = Foo::somefunction();
ok( eq_arrayref_and_file( \@results, 'test1.out' );
Two questions relating to this:
1) My helper functions are defined in FooHelper.pm. This module is
*only* needed for testing (not running/using the actual Foo.pm module).
Should I place it in the lib directory? Is it possible to place it in
the t/ directory and have "make test" still be able to find it?
2) Is there an ideal spot to put supporting static data files? I.e.,
so test1.out can be found in the above example?
I can hack things up on my machine to make both work, but I'm hoping to
eventually but the result on CPAN and any best practices
recommendations would be appreciated.
Thanks!
-Bill
function 'eq_arrayref_and_file', that basically takes an array
reference and compares it to the contents of a static flie. This makes
it easy to test the output of a function by doing something like:
my @results = Foo::somefunction();
ok( eq_arrayref_and_file( \@results, 'test1.out' );
Two questions relating to this:
1) My helper functions are defined in FooHelper.pm. This module is
*only* needed for testing (not running/using the actual Foo.pm module).
Should I place it in the lib directory? Is it possible to place it in
the t/ directory and have "make test" still be able to find it?
2) Is there an ideal spot to put supporting static data files? I.e.,
so test1.out can be found in the above example?
I can hack things up on my machine to make both work, but I'm hoping to
eventually but the result on CPAN and any best practices
recommendations would be appreciated.
Thanks!
-Bill