summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorBrian Fraser <fraserbn@gmail.com>2013-09-21 10:30:48 -0300
committerBrian Fraser <fraserbn@gmail.com>2013-09-21 11:08:05 -0300
commit7bb20a136f11264ca165cb28a8f4c7358d55de6d (patch)
tree0f20c5322d94a53ef250faf558730bc59342a779 /t
parentb740ac3840efd0f189beebdbeef9666d70b90408 (diff)
downloadperl-7bb20a136f11264ca165cb28a8f4c7358d55de6d.tar.gz
Test that ${foo{bar}} and ${\nfoo{bar}} mean the same thing.
This was changed to consistently parse as $foo{bar} in a49b10d0a8. Previously, it would parse to either that or ${(foo {bar})}, depending on the presence of newlines, and the existence of a sub foo with prototype (&).
Diffstat (limited to 't')
-rw-r--r--t/uni/variables.t17
1 files changed, 16 insertions, 1 deletions
diff --git a/t/uni/variables.t b/t/uni/variables.t
index 28d0eb0334..c8e6c8c445 100644
--- a/t/uni/variables.t
+++ b/t/uni/variables.t
@@ -12,7 +12,7 @@ use utf8;
use open qw( :utf8 :std );
no warnings qw(misc reserved);
-plan (tests => 65878);
+plan (tests => 65880);
# ${single:colon} should not be valid syntax
{
@@ -273,3 +273,18 @@ EOP
is($^Q, 24, "...even if we access the variable through the caret name");
is(\${"\cQ"}, \$^Q, '\${\cQ} == \$^Q');
}
+
+{
+ # Prior to 5.19.4, the following changed behavior depending
+ # on the presence of the newline after '@{'.
+ sub foo (&) { [1] }
+ my %foo = (a=>2);
+ my $ret = @{ foo { "a" } };
+ is($ret, $foo{a}, '@{ foo { "a" } } is parsed as @foo{a}');
+
+ $ret = @{
+ foo { "a" }
+ };
+ is($ret, $foo{a}, '@{\nfoo { "a" } } is still parsed as @foo{a}');
+
+}