Mailing List Archive

svn commit: r378385 - in /perl/modperl/docs/trunk/src/docs/general: Changes.pod testing/testing.pod
Author: gozer
Date: Thu Feb 16 14:33:44 2006
New Revision: 378385

URL: http://svn.apache.org/viewcvs?rev=378385&view=rev
Log:
Here is a patch that fixes a few typos.

The example code was also for MP2, but pre-api change, so I moved
it all over to current MP2 syntax.

Submitted-By: Frank Wiles <frank@wiles.org>
Reviewed-By: Perrin Harkins <perrin@elem.com>

Modified:
perl/modperl/docs/trunk/src/docs/general/Changes.pod
perl/modperl/docs/trunk/src/docs/general/testing/testing.pod

Modified: perl/modperl/docs/trunk/src/docs/general/Changes.pod
URL: http://svn.apache.org/viewcvs/perl/modperl/docs/trunk/src/docs/general/Changes.pod?rev=378385&r1=378384&r2=378385&view=diff
==============================================================================
--- perl/modperl/docs/trunk/src/docs/general/Changes.pod (original)
+++ perl/modperl/docs/trunk/src/docs/general/Changes.pod Thu Feb 16 14:33:44 2006
@@ -11,6 +11,10 @@

=head1 ???

+* testing:
+
+ o Fixed some typos and ported example code to MP2
+
* testing:

o moved from 2.0

Modified: perl/modperl/docs/trunk/src/docs/general/testing/testing.pod
URL: http://svn.apache.org/viewcvs/perl/modperl/docs/trunk/src/docs/general/testing/testing.pod?rev=378385&r1=378384&r2=378385&view=diff
==============================================================================
--- perl/modperl/docs/trunk/src/docs/general/testing/testing.pod (original)
+++ perl/modperl/docs/trunk/src/docs/general/testing/testing.pod Thu Feb 16 14:33:44 2006
@@ -29,13 +29,13 @@

=head1 Basics of Perl Module Testing

-The tests themselves are written in Perl. The framework provides an
+The tests themselves are written in Perl. The framework provides
extensive functionality which makes writing tests a simple and
therefore enjoyable process.

If you have ever written or looked at the tests that come with most Perl
modules, you'll recognize that C<Apache::Test> uses the same
-concepts. The script F<t/TEST> executes runs all the files ending with
+concepts. The script F<t/TEST> executes all the files ending with
F<.t> that it finds in the F<t/> directory. When executed, a typical test
prints the following:

@@ -247,7 +247,7 @@
=head2 Parallel Testing

Sometimes you need to run more than one C<Apache-Test> framework
-instances at the same time. In this case you have to use different
+instance at the same time. In this case you have to use different
ports for each instance. You can specify explicitly which port to use
using the I<-port> configuration option. For example, to run the server
on port 34343, do this:
@@ -360,7 +360,7 @@
normal C<make test> or C<.Build test>. However, if some users have a
problem you can ask them to run the test suite with the trace level set
to 'debug' and, voila, they can send you the extra debug output.
-Moreveor, all of these functions use C<Data::Dumper> to dump arguments
+Moreover, all of these functions use C<Data::Dumper> to dump arguments
that are references to perl structures. So for example your code may
look like:

@@ -791,7 +791,7 @@

=head1 Setting Up Testing Environment

-We will assume that you setup your testing environment even before you
+We will assume that you have setup your testing environment even before you
have started coding the project, which is a very smart thing to do.
Of course it'll take you more time upfront, but it'll will save you a
lot of time during the project developing and debugging stages. The
@@ -865,12 +865,12 @@
use strict;
use warnings;

- use Apache::RequestRec ();
- use Apache::RequestIO ();
+ use Apache2::RequestRec ();
+ use Apache2::RequestIO ();

$Apache::Amazing::VERSION = '0.01';

- use Apache::Const -compile => 'OK';
+ use Apache2::Const -compile => 'OK';

sub handler {
my $r = shift;
@@ -1429,7 +1429,7 @@
use warnings FATAL => 'all';

use constant BUFSIZ => 512; #small for testing
- use Apache::Const -compile => 'OK';
+ use Apache2::Const -compile => 'OK';

sub handler {
my $r = shift;
@@ -1439,11 +1439,11 @@
$r->write("ok 1")
$r->write("not ok 2")

- Apache::OK;
+ Apache2::Const::OK;
}
1;

-[F] C<Apache::Const> is mod_perl 2.0's package, if you test under 1.0,
+[F] C<Apache2::Const> is mod_perl 2.0's package, if you test under 1.0,
use the C<Apache::Constants> module instead [/F].

The configuration part for this test will be autogenerated by the
@@ -1533,7 +1533,7 @@
use strict;
use warnings FATAL => 'all';

- use Apache::Const -compile => 'OK';
+ use Apache2::Const -compile => 'OK';

sub handler {
my $r = shift;
@@ -1541,7 +1541,7 @@

$r->write("COOL");

- Apache::OK;
+ Apache2::Const::OK;
}
1;

@@ -2188,7 +2188,7 @@
'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, and that
+C<mod_cgid>, that we run under perl E<gt>= 5.8.0 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.
@@ -2324,8 +2324,8 @@
protocol/*.t

The second pattern skips a single test F<modules/cgi.t>. Note that you
-shouldn't specify the leading F<t/>. The F<.t> extension is optional,
-so you can tell:
+shouldn't specify the leading F<t/>. And the F<.t> extension is optional,
+so you can say:

# skip basic cgi test
modules/cgi
@@ -2336,10 +2336,10 @@
=head2 Reporting a Success or a Failure of Sub-tests

After printing the number of planned sub-tests, and assuming that the
-test is not skipped, the tests is running its sub-tests and each
-sub-test is expected to report its success or failure by printing
-I<ok> or I<not ok> respectively followed by its sequential number and
-a new line. For example:
+test is not skipped, the test runs its sub-tests and each sub-test
+is expected to report its success or failure by printing I<ok> or
+I<not ok> respectively followed by its sequential number and a new
+line. For example:

print "ok 1\n";
print "not ok 2\n";
@@ -2409,9 +2409,9 @@

If the standard output line contains the substring I< # Skip> (with
variations in spacing and case) after I<ok> or I<ok NUMBER>, it is
-counted as a skipped test. C<Test::Harness> reports the text after I<
-# Skip\S*\s+> as a reason for skipping. So you can count a sub-test as
-a skipped as follows:
+counted as a skipped test. C<Test::Harness> reports the text after the
+pattern I< # Skip\S*\s+> as a reason for skipping. So you can count a
+sub-test as a skipped as follows:

print "ok 3 # Skip for some reason\n";

@@ -2662,7 +2662,7 @@
$r->print("ok 1\n");
$r->print("not ok 2\n");

- return Apache::OK;
+ return Apache2::Const::OK;
}

now the client should print the response to STDOUT for
@@ -2684,7 +2684,7 @@
ok "true";
ok "";

- return Apache::OK;
+ return Apache2::Const::OK;
}

However to be on the safe side you also have to call
@@ -2705,7 +2705,7 @@
ok "true";
ok "";

- return Apache::OK;
+ return Apache2::Const::OK;
}

Yet another alternative to handling the test framework printing inside
@@ -2727,7 +2727,7 @@
my $output = Apache::TestToString->finish;
$r->print($output);

- return Apache::OK;
+ return Apache2::Const::OK;
}

In this example C<Apache::TestToString> intercepts and buffers all the
@@ -2940,11 +2940,11 @@

use Apache::Test ();

- use Apache::RequestRec ();
- use Apache::RequestIO ();
+ use Apache2::RequestRec ();
+ use Apache2::RequestIO ();
use File::Spec::Functions qw(catfile);

- use Apache::Const -compile => 'OK';
+ use Apache2::Const -compile => 'OK';

sub handler {
my $r = shift;
@@ -2952,7 +2952,7 @@
$r->content_type('text/plain');
$r->puts($ApacheTest::PerlModuleTest::MAGIC || '');

- Apache::OK;
+ Apache2::Const::OK;
}

sub APACHE_TEST_CONFIGURE {
@@ -3252,16 +3252,16 @@
automatically reload the module when it's changed--by adding following
configuration directives to F<t/conf/extra.conf.in>:

- PerlModule Apache::Reload
- PerlInitHandler Apache::Reload
+ PerlModule Apache2::Reload
+ PerlInitHandler Apache2::Reload
PerlSetVar ReloadAll Off
PerlSetVar ReloadModules "Apache::Amazing"

(For more information about C<Apache::Reload>, depending on the
mod_perl generation, refer to L<the mod_perl 1.0
documentation|docs::1.0::guide::porting/Using_Apache__Reload> or
-L<the C<Apache::Reload> manpage for mod_perl
-2.0|docs::2.0::api::Apache::Reload>.)
+L<the C<Apache2::Reload> manpage for mod_perl
+2.0|docs::2.0::api::Apache2::Reload>.)

now we execute:




---------------------------------------------------------------------
To unsubscribe, e-mail: docs-cvs-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-cvs-help@perl.apache.org