Permalink
Browse files

[t/spec] test for RT #76174, "if" does not break lexical aliasing of …

…$_ in a for-loop

git-svn-id: http://svn.pugscode.org/pugs@31485 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent b8065cb commit 19422e1277efb78b1cbd58e26721b9e4ae30ea1a moritz committed Jun 28, 2010
Showing with 9 additions and 1 deletion.
  1. +9 −1 S04-statements/if.t
View
@@ -11,7 +11,7 @@ Basic "if" tests.
# L<S04/Conditional statements>
-plan 25;
+plan 26;
my $x = 'test';
if ($x eq $x) { pass('if ($x eq $x) {} works'); } else { flunk('if ($x eq $x) {} failed'); }
@@ -156,4 +156,12 @@ if (Mu) { flunk('if (Mu) {} failed'); } else { pass('if (Mu) {} works'); }
# L<S04/Statement parsing/keywords require whitespace>
eval_dies_ok('if($x > 1) {}','keyword needs at least one whitespace after it');
+# RT #76174
+# scoping of $_ in 'if' shouldn't break aliasing
+{
+ my @a = 0, 1, 2;
+ for @a { if $_ { $_++ } };
+ is ~@a, '0 2 3', '"if" does not break lexical aliasing of $_'
+}
+
# vim: ft=perl6

0 comments on commit 19422e1

Please sign in to comment.