/
samecase.t
33 lines (21 loc) · 969 Bytes
/
samecase.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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