- Timestamp:
- 10/09/08 18:33:48 (6 weeks 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
r22544 r22556 1 1 use v6; 2 2 use Test; 3 plan 1 4;3 plan 16; 4 4 5 5 # L<S05/Transliteration/"If the right side of the arrow is a closure"> … … 39 39 is 'hello'.trans(/l/ => { ++$count }), 'he12o', 'regex and closure mix'; 40 40 is 'hello'.trans(/l/ => { $_ x 2 }), 'hellllo', 'regex and closure mix (with $/ as topic)'; 41 is 'hello'.trans(/(l)/ => { $_[0] x 2 }), 'hellllo', 'regex and closure mix (with $/ as topic and capture)'; 41 my $x = 'hello'; 42 is $x.trans(/(l)/ => { $_[0] x 2 }), 'hellllo', 'regex and closure mix (with $/ as topic and capture)'; 43 is $x, 'hello', 'Original string not modified'; 42 44 } 43 45 46 my $orig = 'hello'; 44 47 #?rakudo todo 'Str.trans with regex+closure, RT #59730' 45 is 'hello'.trans(/(l)/ => { $_[0].ord }), 'he108108o', 'capturing regex + closure with .ord on $_'; 48 is $orig.trans(/(l)/ => { $_[0].ord }), 'he108108o', 'capturing regex + closure with .ord on $_'; 49 is $orig, 'hello', 'original string unchanged';
