Skip to content

Commit

Permalink
Add another test for RT #128035
Browse files Browse the repository at this point in the history
Giving the `x` repeat op a too large value should throw instead of going
negative and silently not doing anything.
  • Loading branch information
MasterDuke17 committed Mar 20, 2017
1 parent b68190d commit 1f844e1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion S03-operators/repeat.t
Expand Up @@ -9,7 +9,7 @@ Repeat operators for strings and lists
=end description

plan 62;
plan 63;

#L<S03/Changes to Perl 5 operators/"x (which concatenates repetitions of a string to produce a single string">

Expand Down Expand Up @@ -70,6 +70,9 @@ is('str' x Int, '', 'x with Int type object');
my $a;
lives-ok({ $a = 'a' x 1073741824 }, 'repeat count equal to the NQP limit works');
is($a.chars, 1073741824, 'correct result for count equal to the NQP limit');

#?rakudo todo 'repeat count goes negative instead of throwing'
throws-like({ $a = 'a' x 9999999999999999999 }, Exception, 'too large repeat count throws instead of going negative');
}

#L<S03/Changes to Perl 5 operators/"and xx (which creates a list of repetitions of a list or item)">
Expand Down

0 comments on commit 1f844e1

Please sign in to comment.