You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Randy Kobes <ra...@theoryx5.uwinnipeg.ca> on 2004/07/14 04:18:55 UTC

[mp2] apr/apr-ext constants test

As it was fairly easy to do, here's an implementation
of the apr/constants test split up so that both
t/apr and t/apr-ext use the same code for the tests.

=========================================================
Index: t/apr-ext/constants.t
===================================================================
RCS file: t/apr-ext/constants.t
diff -N t/apr-ext/constants.t
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ t/apr-ext/constants.t	14 Jul 2004 02:05:26 -0000
@@ -0,0 +1,10 @@
+use strict;
+use warnings FATAL => 'all';
+use Apache::Test;
+
+use lib q(t/lib);
+require TestAPRlib::constants;
+
+plan tests => 5;
+
+TestAPRlib::constants::test();
Index: t/apr/constants.t
===================================================================
RCS file: /home/cvs/modperl-2.0/t/apr/constants.t,v
retrieving revision 1.4
diff -u -r1.4 constants.t
--- t/apr/constants.t	8 Jul 2004 06:06:33 -0000	1.4
+++ t/apr/constants.t	14 Jul 2004 02:05:26 -0000
@@ -1,19 +1,10 @@
-use ExtUtils::testlib;
 use strict;
 use warnings FATAL => 'all';
+use Apache::Test;

-use Test;
-
-use Apache2 ();
-use Apache::TestUtil;
-
-use APR::Const -compile => qw(:common POLLIN :filetype);
-use APR::Const qw(:hook);
+use lib q(t/lib);
+require TestAPRlib::constants;

 plan tests => 5;

-ok ! defined &POLLIN;
-ok t_cmp (APR::SUCCESS, 0, 'APR::SUCCESS');
-ok t_cmp (APR::POLLIN, 0x001, 'APR::POLLIN');
-ok t_cmp (HOOK_LAST, 20, 'HOOK_LAST');
-ok t_cmp (APR::UNKFILE, 127, 'APR::UNKFILE');
+TestAPRlib::constants::test();
Index: t/lib/TestAPRlib/constants.pm
===================================================================
RCS file: t/lib/TestAPRlib/constants.pm
diff -N t/lib/TestAPRlib/constants.pm
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ t/lib/TestAPRlib/constants.pm	14 Jul 2004 02:05:26 -0000
@@ -0,0 +1,23 @@
+package TestAPRlib::constants;
+use strict;
+use warnings FATAL => 'all';
+
+use ExtUtils::testlib;
+use Test;
+
+use Apache2 ();
+use Apache::TestUtil;
+
+use APR::Const -compile => qw(:common POLLIN :filetype);
+use APR::Const qw(:hook);
+
+sub test {
+
+    ok ! defined &POLLIN;
+    ok t_cmp (APR::SUCCESS, 0, 'APR::SUCCESS');
+    ok t_cmp (APR::POLLIN, 0x001, 'APR::POLLIN');
+    ok t_cmp (HOOK_LAST, 20, 'HOOK_LAST');
+    ok t_cmp (APR::UNKFILE, 127, 'APR::UNKFILE');
+}
+
+1;

==============================================================

-- 
best regards,
randy

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


Re: [mp2] apr/apr-ext constants test

Posted by Stas Bekman <st...@stason.org>.
Randy Kobes wrote:
> As it was fairly easy to do, here's an implementation
> of the apr/constants test split up so that both
> t/apr and t/apr-ext use the same code for the tests.

well, in the particular case of apr/constants, there is no point to have 
two test ways, because apr/constants.t didn't even touch modperl (it was 
all running on the client side already). so just moving the whole test 
into apr-ext/constants is probably the best approach. or even just 
keeping it where it is now.

in fact now that we have all the multiple tests where the constants are 
tested for real, this test becomes really redundant, since it may break 
any moment if Apache changes the corresponding values for the constants. 
So I consider that test obsolete and we may want to completely remove it.

> +    ok ! defined &POLLIN;
> +    ok t_cmp (APR::SUCCESS, 0, 'APR::SUCCESS');
> +    ok t_cmp (APR::POLLIN, 0x001, 'APR::POLLIN');
> +    ok t_cmp (HOOK_LAST, 20, 'HOOK_LAST');
> +    ok t_cmp (APR::UNKFILE, 127, 'APR::UNKFILE');


-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

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