Welcome to the Monastery | |
PerlMonks |
Re: CPAN test scripts, "run" directory, and test data filesby Anonymous Monk |
on Dec 04, 2015 at 01:47 UTC ( [id://1149358]=note: print w/replies, xml ) | Need Help?? |
My question is what is the directory where the test scripts are run? Is it reliably the parent directory of the "t" (./t) directory? If I put the test data file in t/data (which some modules seem to do), can I assume that from the test script, the file path would be "./t/data/mytestdata.dat"? Try it out and see what it is See Cwd, File::Spec->rel2abs() Observation... looking at the test scripts in other packages, I noticed that is it common for test scripts to create a temporary file, write test data to the file, close it, then re-open it to use for one or more tests, and then delete (unlink) it. Is this the preferred way to do it No this is not common if the data is static. If the data is static, and if you're not testing the creation/deletion of files, then don't create temporary files
In Section
Seekers of Perl Wisdom
|
|