stas 2003/05/27 18:48:15
Modified: perl-framework/Apache-Test/lib/Apache Test.pm
perl-framework/Apache-Test Changes
Log:
add skip helper shortcuts: have_min_perl_version, have_min_module_version
Revision Changes Path
1.60 +48 -1 httpd-test/perl-framework/Apache-Test/lib/Apache/Test.pm
Index: Test.pm
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/Test.pm,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- Test.pm 3 May 2003 03:15:12 -0000 1.59
+++ Test.pm 28 May 2003 01:48:14 -0000 1.60
@@ -14,6 +14,7 @@
@EXPORT = qw(ok skip sok plan have have_lwp have_http11
have_cgi have_access have_auth have_module have_apache
have_min_apache_version have_apache_version have_perl
+ have_min_perl_version have_min_module_version
have_threads under_construction);
$VERSION = '1.03';
@@ -198,6 +199,29 @@
}
}
+sub have_min_perl_version {
+ my $version = shift;
+
+ return 1 if $] >= $version;
+
+ push @SkipReasons, "perl >= $version is required";
+ return 0;
+}
+
+# currently supports only perl modules
+sub have_min_module_version {
+ my($module, $version) = @_;
+
+ # have_module requires the perl module
+ return 0 unless have_module($module);
+
+ my $has_version = $module->VERSION || 0;
+ return 1 if $has_version >= $version;
+
+ push @SkipReasons, "$module version $version or higher is required";
+ return 0;
+}
+
sub have_cgi {
have_module('cgi') || have_module('cgid');
}
@@ -529,6 +553,16 @@
$Config{useithread} eq 'define';
+=item have_min_perl_version
+
+Used to require a minimum version of Perl.
+
+For example:
+
+ plan tests => 5, have_min_perl_version("5.00801");
+
+requires Perl 5.8.1 or higher.
+
=item have_module
plan tests => 5, have_module 'CGI';
@@ -541,6 +575,18 @@
In case of C modules, depending on how the module name was passed it
may pass through the following completions:
+=item have_min_module_version
+
+Used to require a minimum version of a module
+
+For example:
+
+ plan tests => 5, have_min_module_version(CGI => 2.81);
+
+requires C<CGI.pm> version 2.81 or higher.
+
+Currently works only for perl modules.
+
=over
=item 1 have_module 'proxy_http.c'
@@ -564,7 +610,8 @@
plan tests => 5,
have 'LWP',
- { "perl >= 5.8.0 is required" => ($] >= 5.008) },
+ { "perl >= 5.8.0 and w/ithreads is required" =>
+ ($Config{useperlio} && $] >= 5.008) },
{ "not Win32" => sub { $^O eq 'MSWin32' },
"foo is disabled" => \&is_foo_enabled,
},
1.24 +3 -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.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- Changes 20 May 2003 06:01:38 -0000 1.23
+++ Changes 28 May 2003 01:48:14 -0000 1.24
@@ -8,6 +8,9 @@
=item 1.03-dev -
+add skip helper shortcuts: have_min_perl_version,
+have_min_module_version [Stas]
+
pass to 'use lib' only 'lib/' dirs that actually exist in
autogenerated t/TEST t/SMOKE and others. [Stas]