Skip to content

Commit

Permalink
Test chr with huge codepoints throws useful error
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed Mar 8, 2017
1 parent 0336dea commit fbdb818
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion S29-conversions/ord_and_chr.t
Expand Up @@ -123,7 +123,7 @@ my @maps = (
"\o03", 3,
);

plan 54 + @maps;
plan 55 + @maps;

for @maps -> $char, $code {
my $descr = "\\{$code}{$code >= 32 ?? " == '{$char}'" !! ""}";
Expand Down Expand Up @@ -173,4 +173,12 @@ is chr(0x1F42A).ord, 0x1F42A, "chr > ord round trip of high character";

is chrs("104", "101", "108", "108", "111"), 'hello', 'chrs works with a list of numifiable strings';

# RT #130913
subtest 'chr with large codepoints throws useful error' => {
my @tests = 'chr 2⁶³-1', '(2⁶³-1).chr', 'chr 2⁶³',
'(2⁶³-1).chr', 'chr 2¹⁰⁰', '(2¹⁰⁰).chr';
plan +@tests;
throws-like $_, Exception, .perl for @tests;
}

#vim: ft=perl6

2 comments on commit fbdb818

@MasterDuke17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you accidentally duplicated the '(2⁶³-1).chr' test?

@zoffixznet
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah, the second one should be 2⁶³

Please sign in to comment.