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 ge...@apache.org on 2004/04/15 15:17:02 UTC
cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache Test.pm
geoff 2004/04/15 06:17:02
Modified: perl-framework/Apache-Test Changes
perl-framework/Apache-Test/lib/Apache Test.pm
Log:
add :withtestmore import tag to Apache::Test, which will export
all standard Apache::Test symbols except those that collide with
Test::More.
Revision Changes Path
1.122 +4 -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.121
retrieving revision 1.122
diff -u -r1.121 -r1.122
--- Changes 12 Apr 2004 19:34:13 -0000 1.121
+++ Changes 15 Apr 2004 13:17:02 -0000 1.122
@@ -8,6 +8,10 @@
=item 1.10-dev
+add :withtestmore import tag to Apache::Test, which will export
+all standard Apache::Test symbols except those that collide with
+Test::More. [Geoffrey Young]
+
Use function prototypes in Apache::TestUtil functions t_cmp() and
t_is_equal() to handle the case when an argument to the function, is a
function call itself which may return undef (previously had to
1.78 +29 -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.77
retrieving revision 1.78
diff -u -r1.77 -r1.78
--- Test.pm 9 Mar 2004 01:21:32 -0000 1.77
+++ Test.pm 15 Apr 2004 13:17:02 -0000 1.78
@@ -22,7 +22,7 @@
use Config;
use Apache::TestConfig ();
-use vars qw(@ISA @EXPORT $VERSION %SubTests @SkipReasons);
+use vars qw(@ISA @EXPORT %EXPORT_TAGS $VERSION %SubTests @SkipReasons);
@ISA = qw(Exporter);
@EXPORT = qw(ok skip sok plan have have_lwp have_http11
@@ -30,6 +30,12 @@
have_min_apache_version have_apache_version have_perl
have_min_perl_version have_min_module_version
have_threads under_construction have_apache_mpm);
+
+# everything but ok(), skip(), and plan() - Test::More provides these
+my @test_more_exports = grep { ! /^(ok|skip|plan)$/ } @EXPORT;
+
+%EXPORT_TAGS = (withtestmore => \@test_more_exports);
+
$VERSION = '1.10';
%SubTests = ();
@@ -729,6 +735,28 @@
are returned.
=back
+
+=head1 Test::More Integration
+
+There are a few caveats if you want to use I<Apache::Test> with
+I<Test::More> instead of the default I<Test> backend. The first is
+that I<Test::More> requires you to use its own C<plan()> function
+and not the one that ships with I<Apache::Test>. I<Test::More> also
+defines C<ok()> and C<skip()> functions that are different, and
+simply C<use>ing both modules in your test script will lead to redefined
+warnings for these subroutines.
+
+To assist I<Test::More> users we have created a special I<Apache::Test>
+import tag, C<:withtestmore>, which will export all of the standard
+I<Apache::Test> symbols into your namespace except the ones that collide
+with I<Test::More>.
+
+ use Apache::Test qw(:withtestmore);
+ use Test::More;
+
+ plan tests => 1; # Test::More::plan()
+
+ ok ('yes', 'testing ok'); # Test::More::ok()
=head1 Apache::TestToString Class