I've been working at reworking some of the apr tests so that they can also function as apr-ext tests, with as much common code as possible. I have a working set, but before getting into specifics, thought it'd be good to discuss some of the design issues first.
As Stas suggested in some earlier messages, one could put the common tests in one package, and then call it from both t/apr/ and t/apr-ext/. So the simplest tests (eg, constants.t), would look like: ============================================== # file t/apr-ext/constants.t use lib qw(t); require aprlib::constants;
TestAPRlib::constants ? to avoid possible future collisions?
So the first question I had - is there a better name and/or location than "t/aprlib/" to put in the common code?
I'd rather see t/lib and have all those packages there, to clearly separate those from directories with tests. And adjust @INC to include those dirs.
t/lib/TestAPRlib/*
[...]However, all the other tests require something more complex, as the corresponding t/apr/ tests use $r explicitly. What about the following model? For some test foo, one has
I guess this could also be made simpler by, in the common tests, always using APR::Pool and APR::Table, but perhaps it would be good to test $r->pool and $r->notes in an httpd environment?
I think it's the best to split plan() away from the subs with tests. I think the subs should be just ok() tests, like a few wrappers that we have inside normal tests (e.g. the apr/pool tests has a few subs each declares in the comment how many tests it runs.
So I propose the following plan of action. First take the simple tests that can be decoupled from $r and have them put into a separate sub moved into t/lib/..., leave the $r-dependent tests where they are, and to start with run from both locations just those subs which don't require $r.
But, don't forget that we can do Apache::RequestRec->new() and voila, we have $r. It won't work in some cases, but may be something that will be just right in others. Just something to consider.
Let's take one test like apr table, which doesn't depend on $r at all and split it first, then do the rest, once we are happy with that one? the added benefit to start with it, is merging Joe's sub-tests into it.
-- __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
