Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: CPAN test scripts, "run" directory, and test data files

by Anonymous Monk
on Dec 04, 2015 at 01:47 UTC ( [id://1149358]=note: print w/replies, xml ) Need Help??


in reply to CPAN test scripts, "run" directory, and test data files

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

  • Comment on Re: CPAN test scripts, "run" directory, and test data files

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1149358]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-23 06:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found