This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix and test handling of literal newlines in heredocs
[perl5.git] / t / comp / multiline.t
CommitLineData
8d063cd8
LW
1#!./perl
2
79072805 3# $RCSfile: multiline.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:20 $
8d063cd8
LW
4
5print "1..5\n";
6
7open(try,'>Comp.try') || (die "Can't open temp file.");
8
9$x = 'now is the time
10for all good men
11to come to.
c6f14548
GS
12
13
14!
15
8d063cd8
LW
16';
17
18$y = 'now is the time' . "\n" .
19'for all good men' . "\n" .
c6f14548 20'to come to.' . "\n\n\n!\n\n";
8d063cd8
LW
21
22if ($x eq $y) {print "ok 1\n";} else {print "not ok 1\n";}
23
24print try $x;
25close try;
26
27open(try,'Comp.try') || (die "Can't reopen temp file.");
28$count = 0;
29$z = '';
30while (<try>) {
31 $z .= $_;
32 $count = $count + 1;
33}
34
35if ($z eq $y) {print "ok 2\n";} else {print "not ok 2\n";}
36
c6f14548 37if ($count == 7) {print "ok 3\n";} else {print "not ok 3\n";}
8d063cd8 38
3fe9a6f1 39$_ = ($^O eq 'MSWin32') ? `type Comp.try` : `cat Comp.try`;
8d063cd8
LW
40
41if (/.*\n.*\n.*\n$/) {print "ok 4\n";} else {print "not ok 4\n";}
bbad3607
IZ
42
43close(try) || (die "Can't close temp file.");
a0d0e21e 44unlink 'Comp.try' || `/bin/rm -f Comp.try`;
8d063cd8
LW
45
46if ($_ eq $y) {print "ok 5\n";} else {print "not ok 5\n";}