Ticket #1528: conttest.patch
File conttest.patch, 1.8 KB (added by arnsholt, 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 'choose'(do_tailcall, options :flat) 70 tail: 71 .tailcall 'choose'(do_tailcall, options :flat) 67 72 .end 68 73 69 74 .sub 'fail' … … 83 88 .end 84 89 85 90 .sub 'blob' 91 .param int do_tailcall 92 86 93 .local pmc city 87 94 .local pmc store 88 95 .local pmc bx … … 91 98 paths = new 'ResizablePMCArray' 92 99 set_global '!paths', paths 93 100 94 city = 'choose'( "la", "ny", "bos")101 city = 'choose'(do_tailcall, "la", "ny", "bos") 95 102 $P0 = get_global '!results' 96 103 push $P0, city 97 104 push $P0, ' ' … … 110 117 $P0 = new 'ResizableStringArray' 111 118 set_global '!results', $P0 112 119 113 'blob'( )120 'blob'(1) 114 121 final_failure: 115 122 $S0 = join '', $P0 116 123 is('lala nyny bosbos ', $S0, 'Results processed correctly') 117 124 .end 118 125 126 .sub 'returns_tt1528' 127 .local pmc cc 128 129 # Install top-level cc in global. 130 cc = new 'Continuation' 131 set_addr cc, final_failure 132 set_global '!topcc', cc 133 134 $P0 = new 'ResizableStringArray' 135 set_global '!results', $P0 136 137 'blob'(0) 138 final_failure: 139 $S0 = join '', $P0 140 is('lala nyny bosbos ', $S0, 'Results processed correctly - without .tailcall') 141 .end 142 119 143 # end of tests. 120 144 121 145 # Local Variables: