# tests for heredocs besides what is tested in base/lex.t BEGIN { chdir 't' if -d 't'; @INC = '../lib'; require './test.pl'; } use strict; plan(tests => 9); # heredoc without newline (#65838) { my $string = <<'HEREDOC'; testing for 65838 HEREDOC my $code = "<<'HEREDOC';\n${string}HEREDOC"; # HD w/o newline, in eval-string my $hd = eval $code or warn "$@ ---"; is($hd, $string, "no terminating newline in string-eval"); } # here-doc edge cases { my $string = "testing for 65838"; fresh_perl_is( "print <<'HEREDOC';\n${string}\nHEREDOC", $string, {}, "heredoc at EOF without trailing newline" ); fresh_perl_is( "print <<;\n$string\n", $string, { switches => ['-X'] }, "blank-terminated heredoc at EOF" ); fresh_perl_is( "print <<\n$string\n", $string, { switches => ['-X'] }, "blank-terminated heredoc at EOF and no semicolon" ); fresh_perl_is( "print < ['-X'] }, "crlf-terminated heredoc" ); fresh_perl_is( "print qq|\${\\< ['-w'], stderr => 1 }, 'no warning for qq|${\< ['-X'] }, "empty string terminator still needs a newline" ); fresh_perl_like( "print <