Skip to content

Commit

Permalink
Add tests for string and array RHS of numeric ranges.
Browse files Browse the repository at this point in the history
  • Loading branch information
colomon committed Jan 2, 2012
1 parent af353d6 commit 35ebf63
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion S03-operators/range.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 114;
plan 118;


# L<S03/Nonchaining binary precedence/Range object constructor>
Expand Down Expand Up @@ -229,6 +229,19 @@ is (1..6 Z 'a' .. 'c').join, '1a2b3c', 'Ranges and infix:<Z>';
isa_ok (1..$_), Range, '(..) works on Int .. Any';
}

{
my $range = 1 .. '10';
is +$range, 10, "1 .. '10' has ten elements in it";
is +$range.grep(Numeric), 10, "and they are all numbers";
}

{
my @array = 1 .. 10;
my $range = 1 .. @array;
is +$range, 10, "1 .. @array has ten elements in it";
is +$range.grep(Numeric), 10, "and they are all numbers";
}

# RT #82620
#?niecza skip 'trans NYI'
{
Expand Down

0 comments on commit 35ebf63

Please sign in to comment.