Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 45 lines (33 sloc) 1.126 kb
13ef69c [t/spec] string reversal is now spelled flip()
moritz authored
1 use v6;
2 use Test;
3
76ad216 fix some more smartlinks
szabgab authored
4 # L<S32::Str/Str/=item flip>
5
7e9d0f1 [t/spec] added tests
wollmers authored
6 plan 13;
13ef69c [t/spec] string reversal is now spelled flip()
moritz authored
7
8 # As a function :
9 is( flip('Pugs'), 'sguP', "as a function");
10
11 # As a method :
12 is( "".flip, "", "empty string" );
13 is( 'Hello World !'.flip, '! dlroW olleH', "literal" );
14
15 # On a variable ?
16 my Str $a = 'Hello World !';
17 is( $a.flip, '! dlroW olleH', "with a Str variable" );
18 is( $a, 'Hello World !', "flip should not be in-place" );
ade1f3b [t/spec] differentiate reverse from flip and invert
lwall authored
19 is( $a .= flip, '! dlroW olleH', "after a .=flip" );
13ef69c [t/spec] string reversal is now spelled flip()
moritz authored
20
21 # Multiple iterations (don't work in 6.2.12) :
22 is( 'Hello World !'.flip.flip, 'Hello World !',
23 "two flip in a row." );
24
25 # flip with unicode :
26 is( '䀻«'.flip, '«»€ä', "some unicode characters" );
27
ad2abf4 @coke standardize on NYI for things not yet implemented
coke authored
28 #?niecza 2 todo 'graphemes NYI'
29 #?rakudo 2 todo 'graphemes NYI'
7e9d0f1 [t/spec] added tests
wollmers authored
30 is( "a\c[COMBINING DIAERESIS]b".flip, '', "grapheme precomposed" );
fb065e4 [t/spec] added charcter and grapheme tests
wollmers authored
31 is( "a\c[COMBINING DOT ABOVE, COMBINING DOT BELOW]b".flip,
7e9d0f1 [t/spec] added tests
wollmers authored
32 "ba\c[COMBINING DOT ABOVE, COMBINING DOT BELOW]",
33 "grapheme without precomposed");
34
13ef69c [t/spec] string reversal is now spelled flip()
moritz authored
35 is 234.flip, '432', '.flip on non-string';
36 is flip(123), '321', 'flip() on non-strings';
37 {
38 my $x = 'abc';
39 $x.=flip;
40 is $x, 'cba', 'in-place flip';
41 }
42
43
44 # vim: ft=perl6
Something went wrong with that request. Please try again.