Permalink
Browse files

[t/spec] Test for RT #66304: list promoted to array when assigned to …

…scalar

git-svn-id: http://svn.pugscode.org/pugs@28986 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent 0865309 commit 9fbb95aec64b44d476b09d3c1f415c3933cf074b kyle committed Nov 4, 2009
Showing with 20 additions and 1 deletion.
  1. +20 −1 S02-builtin_data_types/lists.t
@@ -7,7 +7,7 @@ use Test;
# for this test. See
# L<"http://www.nntp.perl.org/group/perl.perl6.language/22924">
-plan 21;
+plan *;
# Indexing lists
{
@@ -144,4 +144,23 @@ plan 21;
is <1 2 3>.rt62836_x, 62836, 'call user-declared method in List:: class';
}
+# RT #66304
+{
+ my $rt66304 = (1, 2, 4);
+ isa_ok $rt66304, List, 'List assigned to scalar is-a List';
+ #?rakudo 3 todo 'RT 66304'
+ is( $rt66304.WHAT, (1, 2, 4).WHAT,
+ 'List.WHAT is the same as .WHAT of list assigned to scalar' );
+ dies_ok { $rt66304[1] = 'ro' }, 'literal List element is immutable';
+ is $rt66304, (1, 2, 4), 'List is not changed by attempted assignment';
+
+ my $x = 44;
+ $rt66304 = ( 11, $x, 22 );
+ lives_ok { $rt66304[1] = 'rw' }, 'variable List element is mutable';
+ #?rakudo todo 'RT 66304'
+ is $x, 'rw', 'variable changed via assignment to list element';
+}
+
+done_testing;
+
# vim: ft=perl6

0 comments on commit 9fbb95a

Please sign in to comment.