[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-test-cvs
Subject:    cvs commit: httpd-test/perl-framework/Apache-Test Changes
From:       stas () apache ! org
Date:       2004-04-12 19:34:14
Message-ID: 20040412193414.70056.qmail () minotaur ! apache ! org
[Download RAW message or body]

stas        2004/04/12 12:34:13

  Modified:    perl-framework/Apache-Test/lib/Apache TestUtil.pm
               perl-framework/Apache-Test Changes
  Log:
  Use function prototypes in Apache::TestUtil functions t_cmp() and
  t_is_equal() to handle the case when an argument to the function, is a
  function call itself which may return undef (previously had to
  explicitly force a scalar context to get the undef value). The idea
  was borrowed from Test::More.
  
  Revision  Changes    Path
  1.37      +2 -15     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.36
  retrieving revision 1.37
  diff -u -u -r1.36 -r1.37
  --- TestUtil.pm	12 Apr 2004 18:09:14 -0000	1.36
  +++ TestUtil.pm	12 Apr 2004 19:34:13 -0000	1.37
  @@ -49,7 +49,7 @@
   use constant HAS_DUMPER => eval { $] >= 5.6 && require Data::Dumper; };
   use constant INDENT     => 4;
   
  -sub t_cmp {
  +sub t_cmp ($$;$) {
       Carp::carp(join(":", (caller)[1..2]) . 
           ' usage: $res = t_cmp($expected, $received, [$comment])')
               if @_ < 2 || @_ > 3;
  @@ -247,7 +247,7 @@
   
   # compare any two datastructures (must pass references for non-scalars)
   # undef()'s are valid args
  -sub t_is_equal {
  +sub t_is_equal($$) {
       my ($a, $b) = @_;
       return 0 unless @_ == 2;
   
  @@ -432,19 +432,6 @@
   will do:
   
     "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")
   
   This function is exported by default.
   
  
  
  
  1.121     +6 -0      httpd-test/perl-framework/Apache-Test/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/Changes,v
  retrieving revision 1.120
  retrieving revision 1.121
  diff -u -u -r1.120 -r1.121
  --- Changes	9 Apr 2004 22:22:47 -0000	1.120
  +++ Changes	12 Apr 2004 19:34:13 -0000	1.121
  @@ -8,6 +8,12 @@
   
   =item 1.10-dev
   
  +Use function prototypes in Apache::TestUtil functions t_cmp() and
  +t_is_equal() to handle the case when an argument to the function, is a
  +function call itself which may return undef (previously had to
  +explicitly force a scalar context to get the undef value). The idea
  +was borrowed from Test::More. [Stas]
  +
   Fixed a Windows-only segment which would result in a
   'use of uninitialised value' error if a hash being traversed
   had an entry with a key but an undefined value.  [Ken]
  
  
  
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic