Changeset 22049

Show
Ignore:
Timestamp:
08/27/08 16:55:20 (3 months ago)
Author:
moritz
Message:

[t/spec] loop.t: fudged for rakudo, removed non-sensically test

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • t/spec/S04-statements/loop.t

    r22048 r22049  
    1111=end kwid 
    1212 
    13 plan 14; 
     13plan 11; 
    1414 
    1515# basic loop 
    1616 
    17 my $i = 0; 
    18 is($i, 0, 'verify our starting condition'); 
    19 loop ($i = 0; $i < 10; $i++) {} 
    20 is($i, 10, 'verify our ending condition'); 
     17{ 
     18    my $i = 0; 
     19    is($i, 0, 'verify our starting condition'); 
     20    loop ($i = 0; $i < 10; $i++) {} 
     21    is($i, 10, 'verify our ending condition'); 
     22} 
    2123 
    2224# loop with last() 
    23  
    24 my $i = 0; 
    25 is($i, 0, 'verify our starting condition'); 
    26 loop ($i = 0; $i < 10; $i++) { 
    27     if ($i == 5) {  
    28         last(); # should this really need the () 
     25#?rakudo skip 'last()' 
     26{ 
     27    my $i = 0; 
     28    is($i, 0, 'verify our starting condition'); 
     29    loop ($i = 0; $i < 10; $i++) { 
     30        if ($i == 5) {  
     31            last(); # should this really need the () 
     32        } 
    2933    } 
     34    is($i, 5, 'verify our ending condition'); 
    3035} 
    31 is($i, 5, 'verify our ending condition'); 
    3236 
    3337# infinite loop 
    3438 
    35 my $i = 0; 
    36 is($i, 0, 'verify our starting condition'); 
    37 loop (;;) { $i++; last(); } 
    38 is($i, 1, 'verify our ending condition'); 
     39#?rakudo skip 'last()' 
     40{ 
     41    my $i = 0; 
     42    is($i, 0, 'verify our starting condition'); 
     43    loop (;;) { $i++; last(); } 
     44    is($i, 1, 'verify our ending condition'); 
     45} 
    3946 
    4047# declare variable $j inside loop 
    41 my $count  = 0; 
    42 is($count, 0, 'verify our starting condition'); 
    43 my $j; loop ($j = 0; $j < 10; $j++) { $count++; }; 
    44 is($count, 10, 'verify our ending condition'); 
     48{ 
     49    my $count  = 0; 
     50    is($count, 0, 'verify our starting condition'); 
     51    loop (my $j = 0; $j < 10; $j++) { $count++; }; 
     52    is($count, 10, 'verify our ending condition'); 
     53} 
    4554 
    4655# Ensure condition is tested on the first iteration 
     56#?rakudo skip 'parse loop (;0;)' 
    4757{ 
    4858    my $never_did_body = 1; 
     
    5565 
    5666# Loop with next should still execute the continue expression 
     67#?rakudo skip 'last()' 
    5768{ 
    5869    my ($i,    $continued); 
     
    6677} 
    6778 
    68 my $loopvar = 0; 
     79#?rakudo skip 'last' 
     80{ 
     81    my $loopvar = 0; 
    6982 
    70 loop { 
    71     is($loopvar, $loopvar, "bare loop iterates $loopvar"); 
    72     last if ++$loopvar == 3; 
     83    loop { 
     84        last if ++$loopvar == 3; 
     85    } 
     86    is($loopvar, 3, "bare loop exited after 3 iterations"); 
    7387} 
    74 is($loopvar, 3, "bare loop exited after 3 iterations"); 
     88 
     89# vim: ft=perl6