develooper Front page | perl.perl5.porters | Postings from April 2006

Refitting t/op/pat.t to use test.pl

Thread Next
From:
David Landgren
Date:
April 26, 2006 08:02
Subject:
Refitting t/op/pat.t to use test.pl
Message ID:
444F8B78.9030801@landgren.net
Porters,

I'd like to know if I'm on the right track with this. I've taken 
F<t/op/pat.t> and removed all the crufty make-work $test++ code and 
replaced it by test.pl. I've made a side-by-side comparison view here:

   http://www.landgren.net/perl/pat.html

Some of the main features:

  - use skip() and TODO where applicable
  - named the tests
  - first pass used is() everywhere, now converting over to ok() and 
cmp_ok() where possible.
    Sometimes I've been forced to go funky with is(), I'm not sure why 
(I couldn't get it to work any other way)..
  - kept the line numbering the same, so the formatting may seem a 
little strange. That can be fixed up in whitespace patching afterwards.

Some notes:

Array comparisons used "@interpolation". I added a $" = ' ' at the top 
to clarify this.

There are many ok($cond and $cond and $cond) tests. Should these be 
broken out into discrete tests?

The script had its own home-grown ok() routine. I've replaced that by 
test.pl's own ok(), but the very last stack-busting test fails... I 
don't know whether it is because it is relying on some implementation 
feature.

Some of the test results use regexps to parse the results. From a 
philosophical point of view, I suspect it would be preferable to use 
index and substr.

Now that the test numbering has been removed from the code, the tests 
are no longer sequentially dependent, and may be reordered into a saner 
arrangement.

The impetus was to have the recent op/rxcode.t absorbed into op/pat.t, 
as will as simplifying the work required to add new tests for RT tickets.

So, do I continue, or is this all a waste of time?

Thanks,
David
-- 
"It's overkill of course, but you can never have too much overkill."


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About