[svn:mod_parrot] r543 - mod_parrot/trunk/t/response/TestAPI

[email protected] Thu, 11 Dec 2008 08:06:18 -0800 (PST)
Newsgroups perl.cvs.mod_parrot
Message-ID <[email protected]>
Author: jhorwitz
Date: Thu Dec 11 08:06:17 2008
New Revision: 543

Modified:
   mod_parrot/trunk/t/response/TestAPI/apr_pool.pir

Log:
add test for registering cleanup handlers w/o data arg


Modified: mod_parrot/trunk/t/response/TestAPI/apr_pool.pir
==============================================================================
--- mod_parrot/trunk/t/response/TestAPI/apr_pool.pir	(original)
+++ mod_parrot/trunk/t/response/TestAPI/apr_pool.pir	Thu Dec 11 08:06:17 2008
@@ -5,6 +5,18 @@
     .local pmc ap_const
 
     ap_const = get_root_global [ 'ModParrot'; 'Apache'; 'Constants' ], 'table'
+    printerr "in test cleanup handler "
+    printerr "data="
+    printerr data
+    printerr "\n"
+    $I0 = ap_const['OK']
+    .return($I0)
+.end
+
+.sub test_cleanup_handler_no_data
+    .local pmc ap_const
+
+    ap_const = get_root_global [ 'ModParrot'; 'Apache'; 'Constants' ], 'table'
     printerr "in test cleanup handler\n"
     $I0 = ap_const['OK']
     .return($I0)
@@ -17,7 +29,7 @@
 
     ap_const = get_root_global [ 'ModParrot'; 'Apache'; 'Constants' ], 'table'
 
-    r.'puts'("1..7\n")
+    r.'puts'("1..8\n")
 
   START_1:
     push_eh NOT_OK_1
@@ -67,7 +79,8 @@
   START_5:
     push_eh NOT_OK_5
     $P0 = r.'pool'()
-    $P1 = new 'Undef'
+    $P1 = new 'String'
+    $P1 = 'xyzzy'
     $P2 = get_global 'test_cleanup_handler'
     $P0.'cleanup_register'($P2, $P1)
     pop_eh
@@ -75,31 +88,42 @@
   NOT_OK_5:
     r.'puts'("not ")
   OK_5:
-    r.'puts'("ok 5 - cleanup_register\n")
-    
+    r.'puts'("ok 5 - cleanup_register with data\n")
+
   START_6:
     push_eh NOT_OK_6
     $P0 = r.'pool'()
-    $P0.'tag'('test')
+    $P1 = get_global 'test_cleanup_handler_no_data'
+    $P0.'cleanup_register'($P1)
     pop_eh
     goto OK_6
   NOT_OK_6:
     r.'puts'("not ")
   OK_6:
-    r.'puts'("ok 6 - tag\n")
-
-trace 7
+    r.'puts'("ok 6 - cleanup_register with no data\n")
+    
   START_7:
     push_eh NOT_OK_7
     $P0 = r.'pool'()
-    $P1 = $P0.'parent_get'()
+    $P0.'tag'('test')
     pop_eh
-    $S0 = typeof $P1
-    if $S0 == 'ModParrot;APR;Pool' goto OK_7
+    goto OK_7
   NOT_OK_7:
     r.'puts'("not ")
   OK_7:
-    r.'puts'("ok 7 - parent_get\n")
+    r.'puts'("ok 7 - tag\n")
+
+  START_8:
+    push_eh NOT_OK_8
+    $P0 = r.'pool'()
+    $P1 = $P0.'parent_get'()
+    pop_eh
+    $S0 = typeof $P1
+    if $S0 == 'ModParrot;APR;Pool' goto OK_8
+  NOT_OK_8:
+    r.'puts'("not ")
+  OK_8:
+    r.'puts'("ok 8 - parent_get\n")
 
     $I0 = ap_const['OK']
     .return($I0)