summaryrefslogtreecommitdiff
path: root/t/comp/parser.t
diff options
context:
space:
mode:
Diffstat (limited to 't/comp/parser.t')
-rw-r--r--t/comp/parser.t22
1 files changed, 21 insertions, 1 deletions
diff --git a/t/comp/parser.t b/t/comp/parser.t
index 54ad351eb1..b50d8af29d 100644
--- a/t/comp/parser.t
+++ b/t/comp/parser.t
@@ -9,7 +9,7 @@ BEGIN {
}
require "./test.pl";
-plan( tests => 21 );
+plan( tests => 37 );
eval '%@x=0;';
like( $@, qr/^Can't modify hash dereference in repeat \(x\)/, '%@x=0' );
@@ -97,3 +97,23 @@ print "#";
print(
$data{foo});
pass();
+
+# Bug #21875
+# { q.* => ... } should be interpreted as hash, not block
+
+foreach my $line (split /\n/, <<'EOF')
+1 { foo => 'bar' }
+1 { qoo => 'bar' }
+1 { q => 'bar' }
+1 { qq => 'bar' }
+0 { q,'bar', }
+0 { q=bar= }
+0 { qq=bar= }
+1 { q=bar= => 'bar' }
+EOF
+{
+ my ($expect, $eval) = split / /, $line, 2;
+ my $result = eval $eval;
+ ok($@ eq '', "eval $eval");
+ is(ref $result, $expect ? 'HASH' : '', $eval);
+}