Skip to content

Commit ffb801f

Browse files
committed
chr() on invalid code-points
1 parent 0252b66 commit ffb801f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

S29-conversions/ord_and_chr.t

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ my @maps = (
123123
"\o03", 3,
124124
);
125125

126-
plan 46 + @maps;
126+
plan 50 + @maps;
127127

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

156+
dies_ok {chr(0xD800)}, "chr of surrogate";
157+
dies_ok {chr(0x2FFFE)}, "chr of noncharacter";
158+
dies_ok {chr(0x2FFFF)}, "chr of noncharacter";
159+
dies_ok {chr(0x10FFFF+1)}, "chr out of range";
160+
156161
#?rakudo skip 'ord of empty string'
157162
ok !defined(ord("")), 'ord("") returns an undefined value';
158163

0 commit comments

Comments
 (0)