Skip to content

Commit

Permalink
chr() on invalid code-points
Browse files Browse the repository at this point in the history
  • Loading branch information
dwarring committed Aug 23, 2013
1 parent 0252b66 commit ffb801f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion S29-conversions/ord_and_chr.t
Expand Up @@ -123,7 +123,7 @@ my @maps = (
"\o03", 3,
);

plan 46 + @maps;
plan 50 + @maps;

for @maps -> $char, $code {
my $descr = "\\{$code}{$code >= 32 ?? " == '{$char}'" !! ""}";
Expand Down Expand Up @@ -153,6 +153,11 @@ is (65..75).chrs.ords, '65 66 67 68 69 70 71 72 73 74 75', "chrs > ords round-tr
#?niecza skip "multi-arg variants of chr not in place yet"
is chr(104, 101, 108, 108, 111), 'hello', 'chr works with a list of ints';

dies_ok {chr(0xD800)}, "chr of surrogate";
dies_ok {chr(0x2FFFE)}, "chr of noncharacter";
dies_ok {chr(0x2FFFF)}, "chr of noncharacter";
dies_ok {chr(0x10FFFF+1)}, "chr out of range";

#?rakudo skip 'ord of empty string'
ok !defined(ord("")), 'ord("") returns an undefined value';

Expand Down

0 comments on commit ffb801f

Please sign in to comment.