Devel::Cover recommendations... or maybe not?

Ovid publiustemp-londonpm at yahoo.com
Thu Mar 15 15:57:29 GMT 2007


--- Tara Andrews <tla at mit.edu> wrote:

> On 3/15/07, Pete Sergeant <pete at clueball.com> wrote:
> 
> > and perhaps you have to occasionally tie yourself in
> > knots trying to hit certain failure conditions (especially
> file-system
> > error ones),
> 
> OK, I'll bite.  How?
> 
> Seriously, a list of hints somewhere of "how to programmatically
> manufacture useful sets of edge cases" would be very useful to people
> who want complete testing for their software, but don't have a wizzo
> tester to get us from A to B.

  open my $fh, '>', $file or die $!;
  print $fh $something    or die $!;
  close $fh $something    or die $!;

Some of those 'or die' conditions can be extremely difficult to hit. 
The first could be easy, the rest, not so much.

Other times you'll have something like this and your tests are on
Linux:

  if ( $^O eq 'MSWin32' ) {
     ...
  }

Many folks aren't aware of this, but you can assign to $^O and that
lets you do this:

  {
      local $^O = 'MSWin32';
      # windows-specific tests
  }

But quite often that code is Windows-specific because it will only run
on Windows.

Cheers,
Ovid

--

Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/


More information about the london.pm mailing list