You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-cvs@httpd.apache.org by st...@apache.org on 2003/08/05 20:49:43 UTC
cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache Test.pm
stas 2003/08/05 11:49:43
Modified: perl-framework/Apache-Test/lib/Apache Test.pm
Log:
allow have() to receive 0, 1 as arguments, so we can do things like:
plan tests => 1, have 'Compress::Zlib', 'deflate',
have_min_apache_version("2.0.49");
Revision Changes Path
1.66 +14 -3 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.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- Test.pm 30 Jul 2003 21:31:12 -0000 1.65
+++ Test.pm 5 Aug 2003 18:49:43 -0000 1.66
@@ -157,6 +157,9 @@
$have_all = 0;
}
}
+ elsif ($cond =~ /^(0|1)$/) {
+ $have_all = 0 if $cond == 0;
+ }
else {
$have_all = 0 unless have_module($cond);
}
@@ -651,9 +654,17 @@
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)
+0 or 1, it used to decide whether the requirements very satisfied, so
+you can mix special C<have_*()> functions that return 0 or 1. For
+example:
+
+ plan tests => 1, have 'Compress::Zlib', 'deflate',
+ have_min_apache_version("2.0.49");
+
+If the scalar value is a string, different from 0 or 1, it's passed to
+I<have_module()>. 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.
In the presented example, we require the presense of the C<LWP> Perl