Ticket #1528: conttest2.patch

File conttest2.patch, 1.8 KB (added by whiteknight, 12 years ago)

fix to the test

  • 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    $P0 = 'choose'(do_tailcall, options :flat) 
     70    .return($P0) 
     71  tail: 
     72    .tailcall 'choose'(do_tailcall, options :flat) 
    6773.end 
    6874 
    6975.sub 'fail' 
     
    8389.end 
    8490 
    8591.sub 'blob' 
     92    .param int do_tailcall 
     93 
    8694    .local pmc city 
    8795    .local pmc store 
    8896    .local pmc bx 
     
    9199    paths = new 'ResizablePMCArray' 
    92100    set_global '!paths', paths 
    93101 
    94     city = 'choose'("la", "ny", "bos") 
     102    city = 'choose'(do_tailcall, "la", "ny", "bos") 
    95103    $P0  = get_global '!results' 
    96104    push $P0, city 
    97105    push $P0, ' ' 
     
    110118    $P0 = new 'ResizableStringArray' 
    111119    set_global '!results', $P0 
    112120 
    113     'blob'() 
     121    'blob'(1) 
    114122  final_failure: 
    115123    $S0 = join '', $P0 
    116124    is('lala nyny bosbos ', $S0, 'Results processed correctly') 
    117125.end 
    118126 
     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 
    119144# end of tests. 
    120145 
    121146# Local Variables: