Skip to content

Commit

Permalink
Extend tests for RT #80614 nd RT #125407
Browse files Browse the repository at this point in the history
  • Loading branch information
usev6 committed Jun 17, 2015
1 parent c2ace96 commit c9c2900
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion S03-operators/assign.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use Test;
# V
# L<S03/Changes to Perl 5 operators/list assignment operator now parses on the right>

plan 296;
plan 299;


# tests various assignment styles
Expand Down Expand Up @@ -863,6 +863,27 @@ sub l () { 1, 2 };

is $rt80614, 2, 'assignment to scalar via array item from array item';
is @b[0], 2, 'assignment to array item from array item to scalar';

my $x;
my @c; @c = (); # used to break chained assignment below
$x = @c[0] = 21;
is @c[0], 21, 'chained assignment works';

my @d;
my $y; ($y) = 1; # used to break chained assignment below
my $z = @d[0] = 42;
is @d[0], 42, 'chained assignment works';
}

# RT #125407
{
my @rt125407 = 84, 85;
if False { # note how this never runs
my @ref;
@ref[0] = 1; # used to break chained assignment below
}
my $rt125407 = @rt125407[0] = @rt125407.pop;
is $rt125407, @rt125407[0], '$rt125407 and @rt125407[0] should be equal';
}

# RT #76734
Expand Down

0 comments on commit c9c2900

Please sign in to comment.