Changeset 22038

Show
Ignore:
Timestamp:
08/27/08 11:09:19 (3 months ago)
Author:
moritz
Message:

[t/spec] tests for RT #58352

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • t/spec/S05-match/blocks.t

    r22030 r22038  
    22use Test; 
    33 
    4 plan 12; 
     4plan 17; 
    55 
    66=begin description 
     
    1010See L<See http://rt.perl.org/rt3/Ticket/Display.html?id=58306>. 
    1111 
    12 So now we test that you can use both a regex and its result object in any kind of block. 
     12So now we test that you can use both a regex and its result object in any 
     13kind of block, and in the condition, if any.  
    1314 
    1415=end description 
     
    4748is ~$/, 'd', '... even outside the block'; 
    4849 
    49 # TODO: repeat ... until, gather/take, lambdas 
     50#?rakudo skip 'Using match object in a while loop, RT #58352' 
     51{ 
     52    my $str = 'abc'; 
     53    my $count = 0; 
     54    my $match = '';; 
     55    while $str ~~ /b/ { 
     56        $count++; 
     57        $str = ''; 
     58        $match = "$/"; 
     59    } 
     60    ok $count, 'Can match in the condition of a while loop'; 
     61    is $match, 'b', '... and can use $/ in the block'; 
     62    is "$/",   'b', '... and can use $/ outside the block'; 
     63} 
     64 
     65#?rakudo skip 'Using match object in an if statement, RT #58352' 
     66{ 
     67    my $match = ''; 
     68    if 'xyc' ~~ /x/ { 
     69        $match = "$/"; 
     70    } 
     71    is $match, 'x', 'Can match in the condition of an if statement'; 
     72    is "$/", '  x', '... and can use $/ outside the block'; 
     73} 
     74 
     75# TODO: repeat ... until, gather/take, lambdas, if/unless statement modifiers 
    5076 
    5177# vim: ft=perl6