Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

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

I personally think that creating 't/data/mytesdata.dat' and locating it in the test script as './t/data/mytesdata.dat' is fine.
However, I've struck at least one person who expects the test scripts to be runnable from both the top-level and the 't' directories.
I have no time for that viewpoint, though I pander to it if I think of it (and can be bothered).

IMO, the test suite is designed to be run by 'make test', which means the cwd will be the directory that contains the Makefile (and the Makefile.PL).
If one subsequently needs to run any test scripts outside of the 'make test' process, then one ought to understand that limitations may exist wrt to the location from which the scripts are run (as would be the case with your proposed layout).

Rather than unlink any files, I prefer to have the 'make clean' step remove them - which can be achieved by specifying the 'clean' option in WriteMakefile() in the Makefile.PL:
clean => { FILES => './t/data/out1.dat ./out2.dat' },
It annoys me when I want to inspect the contents of a certain file, only to find that the test script that created that file has also removed it.
There also exist on CPAN some annoying test scripts where the attempts to unlink certain files fail (though these files could be successfully removed by 'make clean' if they were specified in the 'clean' option).

Cheers,
Rob

In reply to Re: CPAN test scripts, "run" directory, and test data files by syphilis
in thread 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 romping around the Monastery: (6)
As of 2024-04-19 11:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found