Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add tests for [+]=, [[+]]=.
  • Loading branch information
jnthn committed Jul 9, 2014
1 parent a47a750 commit 11b5f96
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion S03-operators/assign.t
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 290;
plan 296;


# tests various assignment styles
Expand Down Expand Up @@ -589,6 +589,22 @@ my @p;
is(@p[1],9, "~>= operator parses as item assignment 2");
}

{
my $x = 42;
@p = $x [+]= 6, 7;
is($x, 48, '[+]= operator (just like +=)');
is(@p[0],48, "[+]= operator parses as item assignment 1");
is(@p[1],7, "[+]= operator parses as item assignment 2");
}

{
my $x = 42;
@p = $x [[+]]= 6, 7;
is($x, 48, '[[+]]= operator (just like +=)');
is(@p[0],48, "[[+]]= operator parses as item assignment 1");
is(@p[1],7, "[[+]]= operator parses as item assignment 2");
}

# Tests of dwimming scalar/listiness of lhs

sub l () { 1, 2 };
Expand Down

0 comments on commit 11b5f96

Please sign in to comment.