Skip to content

Commit

Permalink
[t/spec] forbid lists and ranges as Range end points (as per r28171)
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.pugscode.org/pugs@28230 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information
moritz committed Sep 13, 2009
1 parent 828aa7c commit 7f76022
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
16 changes: 13 additions & 3 deletions S03-operators/range.t
Expand Up @@ -2,7 +2,10 @@ use v6;

use Test;

plan 104;
plan 105;


# L<S03/Nonchaining binary precedence/Range object constructor>

# 3..2 must *not* produce "3 2". Use reverse to get a reversed range. -lwall

Expand All @@ -22,8 +25,6 @@ is ~('z'..'Y'), '', '(..) works on auto-rev uppercase letter .. lowercase let
is ~('Y'..'_'), 'Y Z', '(..) works on letter .. non-letter (1)';
is ~('_'..'Y'), '', '(..) works on auto-rev letter .. non-letter (2)';

isnt ~(0..^10), ~(0.. ^10), '(0..^10) is not the same as (0.. ^10)';

is ~(3..9-3), "3 4 5 6", "(..) has correct precedence (1)";
is ~(5..9-5), "", "(..) has correct precedence (2)";
is ~(2+1..6), "3 4 5 6", "(..) has correct precedence (3)";
Expand Down Expand Up @@ -185,6 +186,15 @@ is (1..6 Z 'a' .. 'c').join, '1a2b3c', 'Ranges and infix:<Z>';
is $range.list, <1 2 3>, 'range is correct';
}

# L<S03/Nonchaining binary precedence/it is illegal to use a Range or a
# List as implicitly numeric:>

#?rakudo todo 'forbid Ranges and Lists as Range endpoints'
{
ok !defined(try { 0 .. ^10 }), '0 .. ^10 is illegal';
ok !defined(try { 0 .. (0, 1, 2) }), '0 .. List is illegal';
}

# For tests involving :by, see t/spec/S03-operators/range-by.t
# and t/operators/adverbial_modifiers.t

Expand Down
1 change: 0 additions & 1 deletion TODO
Expand Up @@ -38,7 +38,6 @@ the spec (newest first)
* (r27312) ambiguous authority and 'use'
* (r27066) rangechars are not limited to \w anymore
* (r27045) multi method scoping
* (r28171) [S03] forbid List and Range as endpoint to ranges
* (r28169) :my in regexen
* (r28150, r28151) ::=, implicit 'is context' on $*foo variables
* (r26968) Now we know how $! works.
Expand Down

0 comments on commit 7f76022

Please sign in to comment.