Permalink
Browse files

test for RT #57790, scalars indexed with [1] should return a Failure

  • Loading branch information...
1 parent 8c3cfd3 commit 5ca3dae8bbf33a3e051a2e5389bea2c68c1b3448 @moritz moritz committed Sep 18, 2010
Showing with 3 additions and 2 deletions.
  1. +3 −2 S02-builtin_data_types/array.t
@@ -2,7 +2,7 @@ use v6;
use Test;
-plan 102;
+plan 103;
#L<S02/Mutable types/Array>
@@ -329,14 +329,15 @@ my @array2 = ("test", 1, Mu);
is [][].elems, 0, '[][] returns empty list/array';
}
-# RT #58372
+# RT #58372 and RT #57790
# by current group understanding of #perl6, postcircumifx:<[ ]> is actually
# defined in Any, so that .[0] is the identity operation for non-Positional
# types
{
is 1[0], 1, '.[0] is identiity operation for scalars (Int)';
is 'abc'[0], 'abc', '.[0] is identiity operation for scalars (Str)';
nok 'abc'[1].defined, '.[1] on a scalar is not defined';
+ isa_ok 1[1], Failure, 'indexing a scalar with other than 0 returns a Failure';
dies_ok { Mu.[0] }, 'but Mu has no .[]';
}

0 comments on commit 5ca3dae

Please sign in to comment.