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":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.