Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update spectests for Range endpoint exceptions.
  • Loading branch information
pmichaud committed Mar 16, 2013
1 parent bbe88fe commit 01d1162
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
10 changes: 9 additions & 1 deletion S03-operators/range-basic.t
@@ -1,8 +1,10 @@
use v6;

use Test;
BEGIN { @*INC.push('t/spec/packages') };
use Test::Util;

plan 136;
plan 144;

{
my $range = 2..6;
Expand Down Expand Up @@ -112,6 +114,12 @@ plan 136;
is $range.excludes_max, Bool::True, "1^..^*.excludes_max is true";
}

# some range constructions are invalid
throws_like '10 .. ^20', X::Range::InvalidArg ;
throws_like '^10 .. 20', X::Range::InvalidArg ;
throws_like '* .. ^20', X::Range::InvalidArg ;
throws_like '^10 .. *', X::Range::InvalidArg ;

ok 3 ~~ 1..5, '3 ~~ 1..5';
ok 2.5 ~~ 1..5, '2.5 ~~ 1..5';
ok 2.5e0 ~~ 1..5, '2.5e0 ~~ 1..5';
Expand Down
13 changes: 8 additions & 5 deletions S03-operators/range.t
Expand Up @@ -234,17 +234,20 @@ is (1..6 Z 'a' .. 'c').join, '1a2b3c', 'Ranges and infix:<Z>';
is ~$range, "1 2 3", 'range is correct';
}

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

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

# Lists are allowed on the rhs if the lhs is numeric (Real):
#?niecza todo 'allow List as rhs endpoint'
#?pugs todo
is ~(2 .. [<a b c d e>]), "2 3 4 5", '2 .. @list is legal';

# RT #68788
#?pugs skip 'Missing required parameters: $_'
#?DOES 2
Expand Down

0 comments on commit 01d1162

Please sign in to comment.