stas 01/11/21 19:23:35
Modified: perl-framework/Apache-Test README
perl-framework/Apache-Test/lib/Apache Test.pm
Log:
README
Revision Changes Path
1.16 +6 -0 httpd-test/perl-framework/Apache-Test/README
Index: README
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/README,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- README 2001/10/20 10:55:38 1.15
+++ README 2001/11/22 03:23:34 1.16
@@ -46,6 +46,12 @@
stop the server
% t/TEST -stop
+ping the server to see whether it runs
+% t/TEST -ping
+
+ping the server and wait until the server starts, report waiting time
+% t/TEST -ping=block
+
reconfigure the server, do not run tests
% t/TEST -configure
1.34 +35 -15 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.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- Test.pm 2001/11/16 19:58:09 1.33
+++ Test.pm 2001/11/22 03:23:35 1.34
@@ -138,16 +138,28 @@
}
sub skip_unless {
- my $condition = shift;
- my $reason = shift || "no reason given";
+ my @conditions = @_;
- if (ref $condition eq 'CODE' and $condition->()) {
- return 1;
- }
- else {
- push @SkipReasons, $reason;
- return 0;
+ my $should_skip = 0;
+ for my $cond (@conditions) {
+ if (ref $cond eq 'HASH') {
+ while (my($code, $reason) = each %$cond) {
+ $reason = "no reason given" unless defined $reason;
+ if (ref $code eq 'CODE' and $code->()) {
+ next;
+ }
+ else {
+ push @SkipReasons, $reason;
+ $should_skip++;
+ }
+ }
+ }
+ else {
+ $should_skip++ unless have_module($cond);
+ }
}
+
+ return $should_skip ? 0 : 1;
}
sub have_module {
@@ -307,7 +319,7 @@
But this won't hint the reason for skipping therefore it's better to
use skip_unless():
- plan tests => 5, skip_unless(sub { $a == $b }, "$a != $b");
+ plan tests => 5, skip_unless({sub { $a == $b } => "$a != $b"}, 'LWP');
see skip_unless() for more info.
@@ -350,14 +362,22 @@
Same as I<Test::skip>, see I<Test.pm> documentation.
=item skip_unless
-
- skip_unless($cond_sub, $reason);
-skip_unless() is used with plan(), it executes C<$cond_sub> code
-reference and if it returns a false value C<$reason> gets printed as a
-reason for test skipping.
+ skip_unless({sub {$a==$b} => "$a != $b!"
+ sub {$a==1} => "$a != 1!"},
+ 'LWP',
+ 'cgi_d',
+ {sub {0} => "forced to be skipped"},
+ );
+
+skip_unless() is used with plan(), to decide whether to skip the test
+or not. Its argument is a list of things to test. The list can include
+scalars, which are passed to have_module() and hash references. The
+hash references have condition code ref as a key and the reason for
+failure as a value. The condition code is run and if it fails the
+reason is used to explain the failure.
-see plan().
+Also see plan().
=item test_pm_refresh