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

Refitting t/op/pat.t to use

Thread Next
David Landgren
April 26, 2006 08:02
Refitting t/op/pat.t to use
Message ID:

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 I've made a side-by-side comparison view here:

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'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 

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 

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?

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

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