Ticket #1528: conttest2.patch
File conttest2.patch, 1.8 KB (added by whiteknight, 12 years ago) |
---|
-
t/pmc/continuation.t
18 18 19 19 .sub main :main 20 20 .include 'test_more.pir' 21 plan( 3)21 plan(4) 22 22 23 23 test_new() 24 24 invoke_with_init() 25 25 returns_tt1511() 26 returns_tt1528() 26 27 .end 27 28 28 29 .sub test_new … … 43 44 .end 44 45 45 46 .sub 'choose' 47 .param int do_tailcall 46 48 .param pmc options :slurpy 47 49 .local pmc cc 48 50 .local pmc chosen … … 63 65 .return (chosen) 64 66 65 67 recurse: 66 .tailcall 'choose'(options :flat) 68 if do_tailcall goto tail 69 $P0 = 'choose'(do_tailcall, options :flat) 70 .return($P0) 71 tail: 72 .tailcall 'choose'(do_tailcall, options :flat) 67 73 .end 68 74 69 75 .sub 'fail' … … 83 89 .end 84 90 85 91 .sub 'blob' 92 .param int do_tailcall 93 86 94 .local pmc city 87 95 .local pmc store 88 96 .local pmc bx … … 91 99 paths = new 'ResizablePMCArray' 92 100 set_global '!paths', paths 93 101 94 city = 'choose'( "la", "ny", "bos")102 city = 'choose'(do_tailcall, "la", "ny", "bos") 95 103 $P0 = get_global '!results' 96 104 push $P0, city 97 105 push $P0, ' ' … … 110 118 $P0 = new 'ResizableStringArray' 111 119 set_global '!results', $P0 112 120 113 'blob'( )121 'blob'(1) 114 122 final_failure: 115 123 $S0 = join '', $P0 116 124 is('lala nyny bosbos ', $S0, 'Results processed correctly') 117 125 .end 118 126 127 .sub 'returns_tt1528' 128 .local pmc cc 129 130 # Install top-level cc in global. 131 cc = new 'Continuation' 132 set_addr cc, final_failure 133 set_global '!topcc', cc 134 135 $P0 = new 'ResizableStringArray' 136 set_global '!results', $P0 137 138 'blob'(0) 139 final_failure: 140 $S0 = join '', $P0 141 is('lala nyny bosbos ', $S0, 'Results processed correctly - without .tailcall') 142 .end 143 119 144 # end of tests. 120 145 121 146 # Local Variables: