2 # Copyright (C) 2006-2010, Parrot Foundation.
7 t/pmc/continuation.t - test Continuation PMC
11 % prove t/pmc/continuation.t
15 Tests the Continuation PMC.
20 .include 'test_more.pir'
30 $P0 = new ['Continuation']
31 ok(1, "new Continuation didn't explode")
35 $P0 = new ['Continuation']
38 ok(0, "didn't call continuation")
41 ok(1, "called continuation")
47 .param int do_tailcall
48 .param pmc options :slurpy
53 if options goto got_options
56 chosen = shift options
58 cc = new 'Continuation'
60 paths = get_global '!paths'
63 $P0 = get_global '!results'
68 if do_tailcall goto tail
69 $P0 = 'choose'(do_tailcall, options :flat)
72 .tailcall 'choose'(do_tailcall, options :flat)
79 paths = get_global '!paths'
81 if paths goto got_paths
82 cc = get_global '!topcc'
92 .param int do_tailcall
99 paths = new 'ResizablePMCArray'
100 set_global '!paths', paths
102 city = 'choose'(do_tailcall, "la", "ny", "bos")
103 $P0 = get_global '!results'
110 .sub 'returns_tt1511'
113 # Install top-level cc in global.
114 cc = new 'Continuation'
115 set_addr cc, final_failure
116 set_global '!topcc', cc
118 $P0 = new 'ResizableStringArray'
119 set_global '!results', $P0
124 is('lala nyny bosbos ', $S0, 'Results processed correctly')
127 .sub 'returns_tt1528'
130 # Install top-level cc in global.
131 cc = new 'Continuation'
132 set_addr cc, final_failure
133 set_global '!topcc', cc
135 $P0 = new 'ResizableStringArray'
136 set_global '!results', $P0
141 is('lala nyny bosbos ', $S0, 'Results processed correctly - without .tailcall')
150 # vim: expandtab shiftwidth=4 ft=pir: