summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--t/comp/parser.t14
-rw-r--r--toke.c2
2 files changed, 14 insertions, 2 deletions
diff --git a/t/comp/parser.t b/t/comp/parser.t
index 899f8674ee..ca191c2de0 100644
--- a/t/comp/parser.t
+++ b/t/comp/parser.t
@@ -9,7 +9,7 @@ BEGIN {
}
require "./test.pl";
-plan( tests => 39 );
+plan( tests => 41 );
eval '%@x=0;';
like( $@, qr/^Can't modify hash dereference in repeat \(x\)/, '%@x=0' );
@@ -123,3 +123,15 @@ EOF
ok($@ eq '', "eval $eval");
is(ref $result, $expect ? 'HASH' : '', $eval);
}
+
+# Bug #24212
+{
+ local $SIG{__WARN__} = sub { }; # silence mandatory warning
+ eval q{ my $x = -F 1; };
+ like( $@, qr/syntax error .* near "F 1"/, "unknown filetest operators" );
+ is(
+ eval q{ sub F { 42 } -F 1 },
+ '-42',
+ '-F calls the F function'
+ );
+}
diff --git a/toke.c b/toke.c
index 0b934c1a79..b6b81d244b 100644
--- a/toke.c
+++ b/toke.c
@@ -2878,7 +2878,7 @@ Perl_yylex(pTHX)
"### '-%c' looked like a file test but was not\n",
tmp);
} );
- s -= 2;
+ s = --PL_bufptr;
}
}
tmp = *s++;