perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: modperl-docs/src/docs/general/testing testing.pod
Date Mon, 07 Apr 2003 04:41:47 GMT
stas        2003/04/06 21:41:47

  Modified:    src/docs/general/testing testing.pod
  Log:
  have() now can handle scalars in addition to code refs in hash refs
  
  Revision  Changes    Path
  1.13      +16 -9     modperl-docs/src/docs/general/testing/testing.pod
  
  Index: testing.pod
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/docs/general/testing/testing.pod,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- testing.pod	1 Apr 2003 04:42:47 -0000	1.12
  +++ testing.pod	7 Apr 2003 04:41:47 -0000	1.13
  @@ -1862,23 +1862,30 @@
   requirements at once.
   
   have()'s arguments can include scalars, which are passed to
  -have_module(), and hash references. The hash references have a
  -condition code reference as a value and a reason for failure as a
  -key. The condition code is run and if it fails the provided reason is
  -used to tell user why the test was skipped.
  +have_module(), and hash references. If hash references are used, the
  +keys, are strings, containing a reason for a failure to satisfy this
  +particular entry, the valuees are the condition, which are
  +satisfaction if they return true. If the value is a scalar it's used
  +as is. If the value is a code reference, it gets executed at the time
  +of check and its return value is used to check the condition. If the
  +condition check fails, the provided (in a key) reason is used to tell
  +user why the test was skipped.
   
   For example:
   
     plan tests => 5,
         have 'LWP',
  -           { "perl >= 5.7.3 is required" => sub { $] >= 5.007003   } },
  -           { "not Win32"                 => sub { $^O eq 'MSWin32' } },
  +           { "perl >= 5.8.0 is required" => ($] >= 5.008)          },
  +           { "not Win32"                 => sub { $^O eq 'MSWin32' },
  +             "foo is disabled"           => \&is_foo_enabled,
  +           },
              'cgid';
   
   In this example, we require the presense of the C<LWP> Perl module,
  -C<mod_cgid>, that we run under perl E<gt>= 5.7.3 on Win32. If any of
  -the requirements from this list fail, the test will be skipped and
  -each failed requiremnt will print a reason for its failure.
  +C<mod_cgid>, that we run under perl E<gt>= 5.7.3 on Win32, and that
  +C<is_foo_enabled> returns true. If any of the requirements from this
  +list fail, the test will be skipped and each failed requiremnt will
  +print a reason for its failure.
   
   =item * have_perl()
   
  
  
  

Mime
View raw message