perl-test-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r371931 - in /perl/Apache-Test/trunk: Changes lib/Apache/Test.pm
Date Tue, 24 Jan 2006 14:36:31 GMT
Author: geoff
Date: Tue Jan 24 06:36:29 2006
New Revision: 371931

URL: http://svn.apache.org/viewcvs?rev=371931&view=rev
Log:
this one has been bugging me for as long as I can remember...

previously, if you had something like

  plan tests => 4, need need_cgi,
                        need_min_module_version CGI => 3.16);

and calls _other_ than need_cgi() failed you would get
a misleading skip message like

  all skipped: cannot find module 'cgi',
               CGI version 3.16 or higher is required

due to the way the need_cgi() (and other) aliases 
simply iterated over the stuff they checked.

this fixes that so that the message becomes

  all skipped: CGI version 3.16 or higher is required

if either mod_cgi or mod_cgid were found, and

  all skipped: cannot find one of 'cgi' or 'cgid',
               CGI version 3.16 or higher is required

if neither mod_cgi nor mod_cgid were found.

similarly for need_php(), need_php4(), need_access(), 
and need_auth()

Modified:
    perl/Apache-Test/trunk/Changes
    perl/Apache-Test/trunk/lib/Apache/Test.pm

Modified: perl/Apache-Test/trunk/Changes
URL: http://svn.apache.org/viewcvs/perl/Apache-Test/trunk/Changes?rev=371931&r1=371930&r2=371931&view=diff
==============================================================================
--- perl/Apache-Test/trunk/Changes (original)
+++ perl/Apache-Test/trunk/Changes Tue Jan 24 06:36:29 2006
@@ -8,6 +8,9 @@
 
 =item 1.28-dev
 
+shortcuts like need_cgi() and need_php() no longer spit out
+bogus skip messages  [Geoffrey Young]
+
 Adjust Apache::TestConfig::untaint_path() to handle relative paths
 that don't start with /.  [Stas]
 

Modified: perl/Apache-Test/trunk/lib/Apache/Test.pm
URL: http://svn.apache.org/viewcvs/perl/Apache-Test/trunk/lib/Apache/Test.pm?rev=371931&r1=371930&r2=371931&view=diff
==============================================================================
--- perl/Apache-Test/trunk/lib/Apache/Test.pm (original)
+++ perl/Apache-Test/trunk/lib/Apache/Test.pm Tue Jan 24 06:36:29 2006
@@ -348,23 +348,43 @@
 }
 
 sub need_cgi {
-    need_module('cgi') || need_module('cgid');
+    return _need_multi(qw(cgi cgid));
 }
 
 sub need_php {
-    need_module('php4') || need_module('php5') || need_module('sapi_apache2.c');
+    return _need_multi(qw(php4 php5 sapi_apache2.c));
 }
 
 sub need_php4 {
-    need_module('php4') || need_module('sapi_apache2.c');
+    return _need_multi(qw(php4 php5));
 }
 
 sub need_access {
-    need_module('access') || need_module('authz_host');
+    return _need_multi(qw(access authz_host));
 }
 
 sub need_auth {
-    need_module('auth') || need_module('auth_basic');
+    return _need_multi(qw(auth auth_basic));
+}
+
+sub _need_multi {
+
+    my @need = @_;
+
+    my $rc;
+                                                                                        
                                    
+    {
+        local @SkipReasons;
+                                                                                        
                                    
+        $rc = grep { need_module($_) } @need;
+    }
+
+    my $reason = join ' or ', @need;
+
+    push @SkipReasons, "cannot find one of $reason"
+        unless $rc;
+                                                                                        
                                    
+    return $rc;
 }
 
 sub need_apache {



Mime
View raw message