Help language development. Donate to The Perl Foundation

P5chr cpan:ELIZABETH last updated on 2020-11-11

t/02-chr.t
use v6.*;
use Test;
use P5chr;

plan 516;

is chr(65), "A", 'did we get the right char';
is chr(-2), "�", 'did we get the replacement char';

with 65 { is .&chr, "A", 'did we get the right char' }
with -2 { is .&chr, "�", 'did we get the replacement char' }

for 128 .. 255 {
    is chr($_), '?',    'did we get a ? explicitely';
    is chr($_).ord, $_, 'did we get the number back with ord explicitely';
    is .&chr, '?',    'did we get a ? implicitely';
    is .&chr.ord, $_, 'did we get the number back with ord implicitely';
}

# vim: expandtab shiftwidth=4