Skip to content

Commit

Permalink
[t/spec] Test for RT #66304: list promoted to array when assigned to …
Browse files Browse the repository at this point in the history
…scalar

git-svn-id: http://svn.pugscode.org/pugs@28986 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information
kyle committed Nov 4, 2009
1 parent 0865309 commit 9fbb95a
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion S02-builtin_data_types/lists.t
Expand Up @@ -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
{
Expand Down Expand Up @@ -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.