}
use strict;
-plan(tests => 136);
+plan(tests => 137);
# heredoc without newline (#65838)
{
);
fresh_perl_is(
- "print <<;\n$string\n",
+ qq(print <<"";\n$string\n),
$string,
{ switches => ['-X'] },
"blank-terminated heredoc at EOF"
);
fresh_perl_is(
- "print <<\n$string\n",
+ qq(print <<""\n$string\n),
$string,
{ switches => ['-X'] },
"blank-terminated heredoc at EOF and no semicolon"
# that building with ASAN will reveal the bug and any related regressions.
for (1..31) {
fresh_perl_like(
- "print <<;\n" . "x" x $_,
+ qq(print <<"";\n) . "x" x $_,
qr/find string terminator/,
{ switches => ['-X'] },
"empty string terminator still needs a newline (length $_)"
# also read freed memory, but got an invalid oldoldbufptr in a different way
fresh_perl_like(
- qq(<<\n\$ \n),
+ qq(<<""\n\$ \n),
# valgrind and asan reports an error between these two lines
- qr/^Use of bare << to mean <<"" is deprecated at - line 1\.\s+Final \$/,
+ qr/^Final \$/,
{},
"don't use an invalid oldoldbufptr (some more)"
);
# [perl #125540] this asserted or crashed
fresh_perl_like(
- q(map d$#<<<<),
+ q(map d<<<<""),
qr/Can't find string terminator "" anywhere before EOF at - line 1\./,
{},
"Don't assert parsing a here-doc if we hit EOF early"
unshift @tests, [
$test,
$string,
- "Indented here-doc: $test",
+ "Indented here-doc: <<$modifier$start_delim with end delim '$end_delim'" . ($script_end ? "\\n" : ""),
];
# Eval'd heredoc
push @tests, [
$eval,
$string,
- "Eval'd Indented here-doc: $eval",
+ "Eval'd Indented here-doc: <<$modifier$start_delim with end delim '$end_delim'" . ($script_end ? "\\n" : ""),
+
];
}
}
"indented here-doc with bad indentation"
];
+ push @tests, [
+ "print <<~EOF;\n $string\n $string\n$string\n $string\n EOF",
+ "Indentation on line 3 of here-doc doesn't match delimiter at - line 1.\n",
+ "indented here-doc with bad indentation"
+ ];
+
# If our delim is " EOF ", make sure other spaced version don't match
push @tests, [
"print <<~' EOF ';\n $string\n EOF\nEOF \n EOF \n EOF \n",
" $string\n EOF\nEOF \n EOF \n",
- "intented here-doc matches final delimiter correctly"
+ "indented here-doc matches final delimiter correctly"
];
for my $test (@tests) {