Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I'm working on my first CPAN package and have a question about how, really where the test scripts are run. I'd like to include a data file that is accessed by the test script (eg, 00_core.t). 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"?

Part B of wisdom seeking question is how careful / involved does the test script need to be to specify the directory path and filename in a portable manner?

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? Seems like it might avoid potential problems with say end of line characters, EBCDIC machines, and questions about file directories ...

Many thanks for sharing your experience and wisdom.


In reply to CPAN test scripts, "run" directory, and test data files by dallen16

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (6)
As of 2024-04-23 06:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found