- Timestamp:
- 10/02/08 05:17:32 (2 months ago)
- Files:
-
- 1 modified
-
t/spec/S05-transliteration/with-closure.t (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
t/spec/S05-transliteration/with-closure.t
r22373 r22483 1 1 use v6; 2 2 use Test; 3 plan 6;3 plan 10; 4 4 5 5 # L<S05/Transliteration/"If the right side of the arrow is a closure"> 6 7 #?rakudo skip 'contigent on RT#59446' 8 { 6 9 7 10 my $x = 0; … … 23 26 is $s.trans([<X Y>] => [{++$x},{++$y}]), 'a3b3c4d4', 'can use closures in pairs of arrays'; 24 27 is $s, 'aXbYcYdX', 'Source string unchanged'; 28 29 my $x = 0; 30 my $y = 0; 31 32 my $s2 = 'ABC111DEF111GHI'; 33 34 is $s2.trans([<1 111>] => [{++$x},{++$y}]), 'ABC1DEF2GHI', 'can use closures in pairs of arrays'; 35 is $s2, 'ABC111DEF111GHI', 'Source string unchanged'; 36 is $x, 0, 'Closure not invoked (only longest match used)'; 37 is $y, 2, 'Closure invoked twice (once per replacement)'; 38 39 };
