Changeset 22556 for t

Show
Ignore:
Timestamp:
10/09/08 18:33:48 (6 weeks ago)
Author:
moritz
Message:

[t/spec] more tests for unchanged source string in transliteration tests.

Files:
1 modified

Legend:

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

    r22544 r22556  
    11use v6; 
    22use Test; 
    3 plan 14; 
     3plan 16; 
    44 
    55# L<S05/Transliteration/"If the right side of the arrow is a closure"> 
     
    3939    is 'hello'.trans(/l/ => { ++$count }), 'he12o', 'regex and closure mix'; 
    4040    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'; 
    4244} 
    4345 
     46my $orig = 'hello';  
    4447#?rakudo todo 'Str.trans with regex+closure, RT #59730' 
    45 is 'hello'.trans(/(l)/ => { $_[0].ord }), 'he108108o', 'capturing regex + closure with .ord on $_'; 
     48is $orig.trans(/(l)/ => { $_[0].ord }), 'he108108o', 'capturing regex + closure with .ord on $_'; 
     49is $orig, 'hello', 'original string unchanged';