Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

34 lines (21 sloc) 0.969 kb
use v6;
use Test;
# L<S32::Str/Str/"=item samecase">
=begin pod
Basic test for the samecase() builtin with a string (Str).
=end pod
plan 8;
# As a function
is( samecase('Perl6', 'abcdE'), 'perl6', 'as a function');
# As a method
is( ''.samecase(''), '', 'empty string' );
is( 'Hello World !'.samecase('AbCdEfGhIjKlMnOpQrStUvWxYz'), 'HeLlO WoRlD !', 'literal');
# On a variable
my Str $a = 'Just another Perl6 hacker';
is( $a.samecase('XXXXXXXXXXXXXXXXXXXXXXXXX'), 'JUST ANOTHER PERL6 HACKER', 'with a Str variable' );
is( $a.samecase('äääääääääääääääääääääääää'), 'just another perl6 hacker', 'with a Str variable and <unicode> arg');
is( $a, 'Just another Perl6 hacker', 'samecase should not be in-place' );
is( $a .= samecase('aaaaaaaaaaaaaaaaaaaaaaaa'), 'just another perl6 hacker', 'after a .= samecase(...)' );
# samecase with unicode
is( '䀻«'.samecase('xXxX'), '䀻«', 'some unicode characters' );
# vim: ft=perl6
Jump to Line
Something went wrong with that request. Please try again.