use v6;
use Test;
plan 13;
is( flip('Pugs'), 'sguP', "as a function");
is( "".flip, "", "empty string" );
is( 'Hello World !'.flip, '! dlroW olleH', "literal" );
my Str $a = 'Hello World !';
is( $a.flip, '! dlroW olleH', "with a Str variable" );
is( $a, 'Hello World !', "flip should not be in-place" );
is( $a .= flip, '! dlroW olleH', "after a .=flip" );
is( 'Hello World !'.flip.flip, 'Hello World !',
"two flip in a row." );
is( '䀻«'.flip, '«»€ä', "some unicode characters" );
is( "a\c[COMBINING DIAERESIS]b".flip, 'bä', "grapheme precomposed" );
is( "a\c[COMBINING DOT ABOVE, COMBINING DOT BELOW]b".flip,
"ba\c[COMBINING DOT ABOVE, COMBINING DOT BELOW]",
"grapheme without precomposed");
is 234.flip, '432', '.flip on non-string';
is flip(123), '321', 'flip() on non-strings';
{
my $x = 'abc';
$x.=flip;
is $x, 'cba', 'in-place flip';
}