Changeset 22483 for t

Show
Ignore:
Timestamp:
10/02/08 05:17:32 (2 months ago)
Author:
cjfields
Message:

[t/spec] added tests for checking number of times closures are invoked, ready for fudge

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • t/spec/S05-transliteration/with-closure.t

    r22373 r22483  
    11use v6; 
    22use Test; 
    3 plan 6; 
     3plan 10; 
    44 
    55# L<S05/Transliteration/"If the right side of the arrow is a closure"> 
     6 
     7#?rakudo skip 'contigent on RT#59446' 
     8{ 
    69 
    710my $x = 0; 
     
    2326is $s.trans([<X Y>] => [{++$x},{++$y}]), 'a3b3c4d4', 'can use closures in pairs of arrays'; 
    2427is $s,                              'aXbYcYdX', 'Source string unchanged'; 
     28 
     29my $x = 0; 
     30my $y = 0; 
     31 
     32my $s2 = 'ABC111DEF111GHI'; 
     33 
     34is $s2.trans([<1 111>] => [{++$x},{++$y}]), 'ABC1DEF2GHI', 'can use closures in pairs of arrays'; 
     35is $s2,                              'ABC111DEF111GHI', 'Source string unchanged'; 
     36is $x, 0,                            'Closure not invoked (only longest match used)'; 
     37is $y, 2,                            'Closure invoked twice (once per replacement)'; 
     38 
     39};