This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Correct typo
[perl5.git] / t / op / heredoc.t
index b7e4c7d..0a7bb06 100644 (file)
@@ -7,7 +7,7 @@ BEGIN {
 }
 
 use strict;
-plan(tests => 136);
+plan(tests => 137);
 
 # heredoc without newline (#65838)
 {
@@ -33,13 +33,13 @@ HEREDOC
     );
 
     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"
@@ -75,7 +75,7 @@ HEREDOC
     # 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 $_)"
@@ -100,16 +100,16 @@ HEREDOC
 
     # 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"
@@ -165,7 +165,7 @@ HEREDOC
                 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
@@ -180,7 +180,8 @@ 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" : ""),
+
                 ];
             }
         }
@@ -210,11 +211,17 @@ HEREDOC
         "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) {