Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
tweaks for recent sequence changes
  • Loading branch information
TimToady committed Apr 13, 2015
1 parent 223db17 commit d962576
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
8 changes: 5 additions & 3 deletions S03-sequence/basic.t
Expand Up @@ -3,7 +3,7 @@ use Test;

# L<S03/List infix precedence/"the sequence operator">

plan 133;
plan 134;

# single-term sequence

Expand Down Expand Up @@ -138,8 +138,8 @@ ok ?(one((-5 ... ^5).flat) == 0), '-5 ... ^5 produces just one zero';
throws_like { 1 ... () },
X::Cannot::Empty,
'RT #75698 - empty list on right side of sequence operator does not cause infinite loop (but throws exception)',
action => '.shift',
what => 'List';
action => /endpoint/,
what => /list/;

# RT #73508
is (1,2,4...*)[10], 1024,
Expand Down Expand Up @@ -265,6 +265,8 @@ is ((1,1,2,4,8)[^4], *+*+*+* ... *)[4], 8, 'WhateverCode with arity > 3 gets eno
is (110), 1..10, 'Unicode ellipsis works';
is (1^ 10), 1..^10, 'Unicode ellipsis works excluding final value';

isa_ok ([] ... [])[0], Array, '[] ... [] returns []';

done;

# vim: ft=perl6
7 changes: 2 additions & 5 deletions S03-sequence/misc.t
Expand Up @@ -9,17 +9,14 @@ plan 30;
sub f (Int $n) { $n > 3 ?? 'liftoff!' !! $n + 1 }
is (1, &f ... Str)[^8].join(' '), '1 2 3 4 liftoff!',
'sequence stops when type of endpoint matches';
throws_like { (1, &f ... *)[^8].join(' ') },
throws_like { sink (1, &f ... *)[^8].join(' ') },
X::TypeCheck::Binding,
'sequence terminated by signature mismatch';
}

# L<S03/List infix precedence/'the list on the left is C<Nil>'>

# XXX This is surely the wrong way to test this, but I don't know
# the right way.
#?niecza skip 'Need something on the LHS'
is (() ... *)[^3].perl, '((), (), ())', 'Nil sequence';
throws_like {(() ... *)[0]}, X::Cannot::Empty, 'Nil sequence';

# L<S03/List infix precedence/interleave unrelated sequences>
# multiple return values
Expand Down

0 comments on commit d962576

Please sign in to comment.