Changeset 22453 for t

Show
Ignore:
Timestamp:
09/29/08 18:15:15 (2 months ago)
Author:
cjfields
Message:

[t/spec] transliteration tests for changes in RT #59446 (todo'd or skipped until patch committed)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • t/spec/S05-transliteration/trans.t

    r22165 r22453  
    1111=end pod 
    1212 
    13 plan 49; 
     13plan 51; 
    1414 
    1515is("ABC".trans( ('A'=>'a'), ('B'=>'b'), ('C'=>'c') ), 
     
    7373    "Multiple ranges interpreted in string"); 
    7474 
     75# Per S05 changes 
     76#?rakudo todo 'RT #59446' 
     77{ 
     78is("Whfg nabgure Crey unpxre".trans(' a..z' => '_n..za..m', 'A..Z' => 'N..ZA..M'), 
     79    "Just_another_Perl_hacker", 
     80    "Spaces in interpreted ranges are not skipped (all spaces are important)"); 
     81     
    7582is("Whfg nabgure Crey unpxre".trans(' a .. z' => '_n .. za .. m', 'A .. Z' => 'N .. ZA .. M'), 
    76     "Just_another_Perl_hacker", 
    77     "Spaces in interpreted ranges are skipped, all others are important"); 
     83    "Whfg nnbgure Crey unpxre", 
     84    "Spaces in interpreted ranges are not skipped (all spaces are important)"); 
     85}; 
    7886 
    7987my $a = "abcdefghijklmnopqrstuvwxyz"; 
     
    129137 
    130138is('Good&Plenty'.trans('len' => 'x'), 'Good&Pxxxty', 
    131     'no flags');  
     139    'no flags'); 
    132140 
    133141is('Good&Plenty'.trans(:s, 'len' => 'x',), 'Good&Pxty', 
     
    142150    ' ????????????>&', 
    143151    'array, many-to-many transliteration, complement'); 
     152 
     153# fence-post issue with complement 
     154is(" <>&".trans(:c, ([' ', '>'] => 
     155    ['???',      'AB'])), 
     156    ' ????????????>???????????????', 
     157    'fence-post issue (make sure to replace end bits as well)'); 
    144158     
    145159is(" <>&".trans(:c, :s, ([' ', '>', '&'] => 
     
    148162    '... and now complement and squash'); 
    149163 
    150 # check for regex support 
    151  
     164#?rakudo skip 'RT #59446' 
     165{ 
    152166# remove vowel and character after 
    153 #?rakudo 2 skip 'regex in .trans not implemented' 
    154 is('abcdefghij'.trans(/<[aeiou]> \w/ => ''), 'cdfgh', 'basic regex works'); 
     167is('abcdefghij'.trans(/<[aeiou]> \w/ => ''), 'cdgh', 'basic regex works'); 
    155168is( # vowels become 'y' and whitespace becomes '_' 
    156169    "ab\ncd\tef gh".trans(/<[aeiou]>/ => 'y', /\s/ => '_'), 
     
    159172); 
    160173 
    161 # check for closure support 
    162 #?rakudo skip 'regex and closures in .trans not implemented' 
    163 { 
    164     my $i = 0; 
    165     is('ab_cd_ef_gh'.trans('_' => {$i++}), 'ab0cd1ef2gh', 'basic closure'); 
    166  
    167     my($i, $j) = (0, 0); 
    168     is( 
    169         'a_b/c_d/e_f'.trans('_' => {$i++}, '/' => {$j++}), 
    170         'a0b0c1d1e2f', 
    171         'closure pairs work', 
    172     ); 
    173  
     174my $i = 0; 
     175is('ab_cd_ef_gh'.trans('_' => {$i++}), 'ab0cd1ef2gh', 'basic closure'); 
     176 
     177$i = 0; 
     178my $j = 0; 
     179is( 
     180    'a_b/c_d/e_f'.trans('_' => {$i++}, '/' => {$j++}), 
     181    'a0b0c1d1e2f', 
     182    'closure pairs work', 
     183); 
     184}; 
     185 
     186#?rakudo skip 'passing regex to closures in .trans not working yet...' 
     187{ 
    174188    # closures and regexes! 
    175189    is(