G'day AnomalousMonk,

"The naming convention for SomeModule.pm test code is SomeModule.t. This is not enforced in any way, but it's what everyone expects."

I have never encountered that convention — where have you seen it? I certainly wouldn't expect it; I've mostly seen test files starting with numbers and are all lowercase (e.g. nn-name.t).

A t/ directory I'd create for an OO module might look something like:

00-load.t # test 'use' 01-instantiate.t # test 'new()' 02-some_func.t # test 'some_func()' ... # and so on ...

And, as a real world example, here's part of the output of make test for a $work module I ran in the last hour:

t/00-load.t ............... ok t/01-instantiate.t ........ ok t/02-overload.t ........... ok t/03-validation.t ......... ok ...

Just in case I was having a sudden, and unexpected, mental breakdown, I checked a few arbitrary, but well-known, CPAN modules' t/ directories:

Module Repo t/
Text::CSV https://github.com/makamaka/Text-CSV/tree/master/t
JSON https://github.com/makamaka/JSON/tree/master/t
DBI https://github.com/perl5-dbi/dbi/tree/master/t
XML::LibXML https://github.com/shlomif/perl-XML-LibXML/tree/master/t

As you can see, for the most part they all follow the same basic naming convention (i.e. number, name, .t). There are a few exceptions (e.g. pod.t) but there are none that look like your SomeModule.t.

— Ken


In reply to Re^3: Stupidest Prime Number detector ever!! [*.t naming convention] by kcott
in thread Stupidest Prime Number detector ever!! by Anonymous Monk

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.