You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by ra...@apache.org on 2004/07/15 18:14:30 UTC
cvs commit: modperl-2.0/t/response/TestAPR uuid.pm
randyk 2004/07/15 09:14:30
Modified: t/apr-ext uuid.t
t/response/TestAPR uuid.pm
Added: t/lib/TestAPRlib uuid.pm
Log:
Reviewed by: stas
move common uuid tests under t/lib/TestAPRlib/, and call them
from both t/apr/ and t/apr-ext/.
Revision Changes Path
1.4 +14 -22 modperl-2.0/t/apr-ext/uuid.t
Index: uuid.t
===================================================================
RCS file: /home/cvs/modperl-2.0/t/apr-ext/uuid.t,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- uuid.t 12 Aug 2003 23:13:20 -0000 1.3
+++ uuid.t 15 Jul 2004 16:14:30 -0000 1.4
@@ -7,33 +7,25 @@
use Apache::Test;
use Apache::Build ();
-my $build = Apache::Build->build_config;
-
# XXX: only when apr-config is found APR will be linked against
# libapr/libaprutil, probably need a more intuitive method for this
# prerequisite
# also need to check whether we build against the source tree, in
# which case we APR.so won't be linked against libapr/libaprutil
-my $has_apr_config = $build->{apr_config_path} &&
- !$build->httpd_is_source_tree;
-
-plan tests => 3,
- have {"the build couldn't find apr-config" => $has_apr_config};
-
-my $dummy_uuid = 'd48889bb-d11d-b211-8567-ec81968c93c6';
-
-require APR;
-require APR::UUID;
-
-#XXX: apr_generate_random_bytes may block forever on /dev/random
-# my $uuid = APR::UUID->new->format;
-my $uuid = $dummy_uuid;
-
-ok $uuid;
-
-my $uuid_parsed = APR::UUID->parse($uuid);
+# In order to do this for all the apr-ext tests, could have
+# a wrapper around plan() that does a check like
+#######
+# my $build = Apache::Build->build_config;
+#
+# my $has_apr_config = $build->{apr_config_path} &&
+# !$build->httpd_is_source_tree;
+# plan tests => TestAPRlib::uuid::num_of_tests(),
+# have {"the build couldn't find apr-config" => $has_apr_config};
+######
+# that is called from some TestAPRlib::common.
-ok $uuid_parsed;
+use TestAPRlib::uuid;
-ok $uuid eq $uuid_parsed->format;
+plan tests => TestAPRlib::uuid::num_of_tests();
+TestAPRlib::uuid::test();
1.1 modperl-2.0/t/lib/TestAPRlib/uuid.pm
Index: uuid.pm
===================================================================
package TestAPRlib::uuid;
use strict;
use warnings FATAL => 'all';
use Apache::Test;
my $dummy_uuid = 'd48889bb-d11d-b211-8567-ec81968c93c6';
require APR;
require APR::UUID;
#XXX: apr_generate_random_bytes may block forever on /dev/random
# my $uuid = APR::UUID->new->format;
sub num_of_tests {
return 3;
}
sub test {
my $uuid = $dummy_uuid;
ok $uuid;
my $uuid_parsed = APR::UUID->parse($uuid);
ok $uuid_parsed;
ok $uuid eq $uuid_parsed->format;
}
1;
1.4 +3 -15 modperl-2.0/t/response/TestAPR/uuid.pm
Index: uuid.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestAPR/uuid.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- uuid.pm 22 May 2002 00:55:40 -0000 1.3
+++ uuid.pm 15 Jul 2004 16:14:30 -0000 1.4
@@ -5,28 +5,16 @@
use Apache::Test;
-use APR::UUID ();
+use TestAPRlib::uuid;
use Apache::Const -compile => 'OK';
-my $dummy_uuid = 'd48889bb-d11d-b211-8567-ec81968c93c6';
-
sub handler {
my $r = shift;
- plan $r, tests => 3;
-
-#XXX: apr_generate_random_bytes may block forever on /dev/random
-# my $uuid = APR::UUID->new->format;
- my $uuid = $dummy_uuid;
-
- ok $uuid;
-
- my $uuid_parsed = APR::UUID->parse($uuid);
-
- ok $uuid_parsed;
+ plan $r, tests => TestAPRlib::uuid::num_of_tests();
- ok $uuid eq $uuid_parsed->format;
+ TestAPRlib::uuid::test();
Apache::OK;
}