develooper Front page | perl.perl5.porters | Postings from November 2012

[perl #115838] t/op: Move tests not using t/ into a separate directory

Thread Previous
James E Keenan
November 20, 2012 05:09
[perl #115838] t/op: Move tests not using t/ into a separate directory
Message ID:
# New Ticket Created by  James E Keenan 
# Please include the string:  [perl #115838]
# in the subject line of all future correspondence about this issue. 
# <URL: >

During the last year, a number of contributors have worked to convert 
tests in the Perl 5 core distribution which are hard-coded to using 
functions imported from t/  On at least two occasions those 
contributors have gotten burned by being informed, after doing the work 
of conversion, that the files being converted were ineligible for that 
conversion because they tested Perl features which t/ uses and, 
therefore, assumes are already demonstrably functional.

This past weekend, as part of the St Louis Perl Hackathon, I converted 
t/op/arith.t to using t/ at the same time that I added 
descriptions to 140 of its 167 individual tests 
(  I felt that 
conversion would be unproblematic, since t/op is one of the directories 
described by 'perlhack' as okay for usage of t/

=item * F<t/cmd>, F<t/run>, F<t/io> and F<t/op>
Now that basic require() and subroutines are tested, you can use the
F<t/> library.

You can also use certain libraries like Config conditionally, but be
sure to skip the test gracefully if it's not there.

Father C. objected, saying that t/op/arith.t tests the infix + operator, 
but t/ presumes that that operator is already proven to work.

This situation is clearly unsatisfactory.  For the long-term maintenance 
of the test suite, we need to be able to state precisely whether a 
particular feature of Perl (a) requires hard-coded tests; (b) may use 
t/ but not Test::More; or (c) may use Test::More.  The directory 
structure under t/ should reflect that classification.

I don't think we can solve this problem in one fell swoop, but I do 
think we can make some improvements relatively quickly.  I therefore 
propose the following as a first step:

* Create a new subdirectory called t/opbasic.
* Move any t/op/*.t files which do not already use t/ into 
t/opbasic -- i.e., assume that any t/op/t file which already uses 
t/ does so properly.
* Adjust 'perlhack' and other documentation as needed.
* Study those files which we have moved to t/opbasic to see whether they 
are, in fact, eligible to use t/  If so, move them back to t/op 
and convert them.

And as a corollary, encourage new contributors to add descriptions to 
the files under t/op, as we did in St Louis this past weekend.

Thank you very much.
Jim Keenan

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About