Permalink
Browse files

Add tests for string and array RHS of numeric ranges.

  • Loading branch information...
1 parent af353d6 commit 35ebf63d8dde354bdf4885bfe3ddb1c82b9a8ee0 @colomon colomon committed Jan 2, 2012
Showing with 14 additions and 1 deletion.
  1. +14 −1 S03-operators/range.t
View
@@ -2,7 +2,7 @@ use v6;
use Test;
-plan 114;
+plan 118;
# L<S03/Nonchaining binary precedence/Range object constructor>
@@ -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'
{

0 comments on commit 35ebf63

Please sign in to comment.