Ticket #1528: conttest.patch

File conttest.patch, 1.8 KB (added by arnsholt, 12 years ago)

Patch for test file. Created with svn diff at the parrot root.

  • t/pmc/continuation.t

     
    1818 
    1919.sub main :main 
    2020    .include 'test_more.pir' 
    21     plan(3) 
     21    plan(4) 
    2222 
    2323    test_new() 
    2424    invoke_with_init() 
    2525    returns_tt1511() 
     26    returns_tt1528() 
    2627.end 
    2728 
    2829.sub test_new 
     
    4344.end 
    4445 
    4546.sub 'choose' 
     47    .param int do_tailcall 
    4648    .param pmc options :slurpy 
    4749    .local pmc cc 
    4850    .local pmc chosen 
     
    6365    .return (chosen) 
    6466 
    6567  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) 
    6772.end 
    6873 
    6974.sub 'fail' 
     
    8388.end 
    8489 
    8590.sub 'blob' 
     91    .param int do_tailcall 
     92 
    8693    .local pmc city 
    8794    .local pmc store 
    8895    .local pmc bx 
     
    9198    paths = new 'ResizablePMCArray' 
    9299    set_global '!paths', paths 
    93100 
    94     city = 'choose'("la", "ny", "bos") 
     101    city = 'choose'(do_tailcall, "la", "ny", "bos") 
    95102    $P0  = get_global '!results' 
    96103    push $P0, city 
    97104    push $P0, ' ' 
     
    110117    $P0 = new 'ResizableStringArray' 
    111118    set_global '!results', $P0 
    112119 
    113     'blob'() 
     120    'blob'(1) 
    114121  final_failure: 
    115122    $S0 = join '', $P0 
    116123    is('lala nyny bosbos ', $S0, 'Results processed correctly') 
    117124.end 
    118125 
     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 
    119143# end of tests. 
    120144 
    121145# Local Variables: