it's probably better to have a new 'sub cleanup_sub_pool', otherwise how do we know that it's not the main pool that gets destroyed twice?

  +    # should destroy the subpool too, so
  +    # cleanup is called twice
       $p->destroy;


also should we test that a sub-pool is destroyed before the main pool?

how about this


--- t/response/TestAPR/pool.pm  5 Sep 2003 16:30:45 -0000       1.4
+++ t/response/TestAPR/pool.pm  5 Sep 2003 17:34:47 -0000
@@ -5,13 +5,20 @@

use Apache::Test;

+use Apache::RequestRec ();
 use APR::Pool ();
+use APR::Table ();

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

-sub cleanup {
-    my $arg = shift;
-    ok $arg == 33;
+sub parent_cleanup {
+    shift->notes->add(cleanup => 'parent');
+    1;
+}
+
+sub child_cleanup {
+    shift->notes->set(cleanup => 'child');
+    1;
 }

 sub handler {
@@ -31,12 +38,15 @@
 #    my $num_bytes = $p->num_bytes;
 #    ok $num_bytes;

-    $p->cleanup_register(\&cleanup, 33);
-    $subp->cleanup_register(\&cleanup, 33);
+    $p->cleanup_register(\&parent_cleanup, $r);
+    $subp->cleanup_register(\&child_cleanup, $r);

-    # should destroy the subpool too, so
-    # cleanup is called twice
+    # should destroy the subpool too
     $p->destroy;
+
+    my @notes = $r->notes->get('cleanup');
+    ok $notes[0] eq 'child';
+    ok $notes[1] eq 'parent';

     Apache::OK;
 }


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to