- Timestamp:
- 09/29/08 18:15:15 (2 months ago)
- Files:
-
- 1 modified
-
t/spec/S05-transliteration/trans.t (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
t/spec/S05-transliteration/trans.t
r22165 r22453 11 11 =end pod 12 12 13 plan 49;13 plan 51; 14 14 15 15 is("ABC".trans( ('A'=>'a'), ('B'=>'b'), ('C'=>'c') ), … … 73 73 "Multiple ranges interpreted in string"); 74 74 75 # Per S05 changes 76 #?rakudo todo 'RT #59446' 77 { 78 is("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 75 82 is("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 }; 78 86 79 87 my $a = "abcdefghijklmnopqrstuvwxyz"; … … 129 137 130 138 is('Good&Plenty'.trans('len' => 'x'), 'Good&Pxxxty', 131 'no flags'); 139 'no flags'); 132 140 133 141 is('Good&Plenty'.trans(:s, 'len' => 'x',), 'Good&Pxty', … … 142 150 ' ????????????>&', 143 151 'array, many-to-many transliteration, complement'); 152 153 # fence-post issue with complement 154 is(" <>&".trans(:c, ([' ', '>'] => 155 ['???', 'AB'])), 156 ' ????????????>???????????????', 157 'fence-post issue (make sure to replace end bits as well)'); 144 158 145 159 is(" <>&".trans(:c, :s, ([' ', '>', '&'] => … … 148 162 '... and now complement and squash'); 149 163 150 # check for regex support151 164 #?rakudo skip 'RT #59446' 165 { 152 166 # remove vowel and character after 153 #?rakudo 2 skip 'regex in .trans not implemented' 154 is('abcdefghij'.trans(/<[aeiou]> \w/ => ''), 'cdfgh', 'basic regex works'); 167 is('abcdefghij'.trans(/<[aeiou]> \w/ => ''), 'cdgh', 'basic regex works'); 155 168 is( # vowels become 'y' and whitespace becomes '_' 156 169 "ab\ncd\tef gh".trans(/<[aeiou]>/ => 'y', /\s/ => '_'), … … 159 172 ); 160 173 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 174 my $i = 0; 175 is('ab_cd_ef_gh'.trans('_' => {$i++}), 'ab0cd1ef2gh', 'basic closure'); 176 177 $i = 0; 178 my $j = 0; 179 is( 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 { 174 188 # closures and regexes! 175 189 is(
