[svn:parrot] r45204 - trunk/t/pmc

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Sat Mar 27 19:11:19 UTC 2010


Author: whiteknight
Date: Sat Mar 27 19:11:19 2010
New Revision: 45204
URL: https://trac.parrot.org/parrot/changeset/45204

Log:
Applying patch from #1528, plus small correction to make the test pass. Resolves T #1528

Modified:
   trunk/t/pmc/continuation.t

Modified: trunk/t/pmc/continuation.t
==============================================================================
--- trunk/t/pmc/continuation.t	Sat Mar 27 18:33:48 2010	(r45203)
+++ trunk/t/pmc/continuation.t	Sat Mar 27 19:11:19 2010	(r45204)
@@ -18,11 +18,12 @@
 
 .sub main :main
     .include 'test_more.pir'
-    plan(3)
+    plan(4)
 
     test_new()
     invoke_with_init()
     returns_tt1511()
+    returns_tt1528()
 .end
 
 .sub test_new
@@ -43,6 +44,7 @@
 .end
 
 .sub 'choose'
+    .param int do_tailcall
     .param pmc options :slurpy
     .local pmc cc
     .local pmc chosen
@@ -63,7 +65,11 @@
     .return (chosen)
 
   recurse:
-    .tailcall 'choose'(options :flat)
+    if do_tailcall goto tail
+    $P0 = 'choose'(do_tailcall, options :flat)
+    .return($P0)
+  tail:
+    .tailcall 'choose'(do_tailcall, options :flat)
 .end
 
 .sub 'fail'
@@ -83,6 +89,8 @@
 .end
 
 .sub 'blob'
+    .param int do_tailcall
+
     .local pmc city
     .local pmc store
     .local pmc bx
@@ -91,7 +99,7 @@
     paths = new 'ResizablePMCArray'
     set_global '!paths', paths
 
-    city = 'choose'("la", "ny", "bos")
+    city = 'choose'(do_tailcall, "la", "ny", "bos")
     $P0  = get_global '!results'
     push $P0, city
     push $P0, ' '
@@ -110,12 +118,29 @@
     $P0 = new 'ResizableStringArray'
     set_global '!results', $P0
 
-    'blob'()
+    'blob'(1)
   final_failure:
     $S0 = join '', $P0
     is('lala nyny bosbos ', $S0, 'Results processed correctly')
 .end
 
+.sub 'returns_tt1528'
+    .local pmc cc
+
+    # Install top-level cc in global.
+    cc = new 'Continuation'
+    set_addr cc, final_failure
+    set_global '!topcc', cc
+
+    $P0 = new 'ResizableStringArray'
+    set_global '!results', $P0
+
+    'blob'(0)
+  final_failure:
+    $S0 = join '', $P0
+    is('lala nyny bosbos ', $S0, 'Results processed correctly - without .tailcall')
+.end
+
 # end of tests.
 
 # Local Variables:


More information about the parrot-commits mailing list