httpd-test-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestUtil.pm
Date Mon, 12 Apr 2004 18:02:15 GMT
stas        2004/04/12 11:02:15

  Modified:    perl-framework/Apache-Test/lib/Apache TestUtil.pm
  Log:
  explain how to handle undef values in t_cmp
  Submitted by:	William McKee <william@knowmad.com>
  
  Revision  Changes    Path
  1.35      +15 -0     httpd-test/perl-framework/Apache-Test/lib/Apache/TestUtil.pm
  
  Index: TestUtil.pm
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestUtil.pm,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -u -r1.34 -r1.35
  --- TestUtil.pm	9 Mar 2004 06:31:05 -0000	1.34
  +++ TestUtil.pm	12 Apr 2004 18:02:15 -0000	1.35
  @@ -433,6 +433,21 @@
   
     "abcd" =~ /^abc/;
   
  +When comparing to a return value from a function, that may return an
  +C<undef> value, there is a catch -- in the list context the C<undef>
  +value disappears and you end up comparing with the next argument.
  +Therefore you can either explicitly call the function prior to
  +comparison:
  +
  +  my $received = foo();
  +  t_cmp($expected, $received, "may return undef")
  +
  +or use a scalar context:
  +
  +  t_cmp($expected, scalar(foo()), "may return undef")
  +
  +the parentheses for the C<scalar()>'s expression are mandatory here.
  +
   This function is exported by default.
   
   =item t_debug()
  
  
  

Mime
View raw message