This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Cleanup and $. check
[perl5.git]
/
t
/
comp
/
multiline.t
diff --git
a/t/comp/multiline.t
b/t/comp/multiline.t
old mode 100644
(file)
new mode 100755
(executable)
index
5565081
..
742ba49
--- a/
t/comp/multiline.t
+++ b/
t/comp/multiline.t
@@
-1,40
+1,53
@@
#!./perl
#!./perl
-# $Header: multiline.t,v 4.0 91/03/20 01:50:15 lwall Locked $
+BEGIN: {
+ chdir 't';
+ @INC = '../lib';
+ require './test.pl';
+}
-p
rint "1..5\n"
;
+p
lan(tests => 6)
;
-open(
try
,'>Comp.try') || (die "Can't open temp file.");
+open(
TRY
,'>Comp.try') || (die "Can't open temp file.");
$x = 'now is the time
for all good men
to come to.
$x = 'now is the time
for all good men
to come to.
+
+
+!
+
';
$y = 'now is the time' . "\n" .
'for all good men' . "\n" .
';
$y = 'now is the time' . "\n" .
'for all good men' . "\n" .
-'to come to.' . "\n";
+'to come to.' . "\n
\n\n!\n\n
";
-i
f ($x eq $y) {print "ok 1\n";} else {print "not ok 1\n";}
+i
s($x, $y, 'test data is sane');
-print
try
$x;
-close
try
;
+print
TRY
$x;
+close
TRY
;
-open(
try
,'Comp.try') || (die "Can't reopen temp file.");
+open(
TRY
,'Comp.try') || (die "Can't reopen temp file.");
$count = 0;
$z = '';
$count = 0;
$z = '';
-while (<
try
>) {
+while (<
TRY
>) {
$z .= $_;
$count = $count + 1;
}
$z .= $_;
$count = $count + 1;
}
-if ($z eq $y) {print "ok 2\n";} else {print "not ok 2\n";}
+is($z, $y, 'basic multiline reading');
+
+is($count, 7, ' line count');
+is($., 7, ' $.' );
-if ($count == 3) {print "ok 3\n";} else {print "not ok 3\n";}
+$out = (($^O eq 'MSWin32') || $^O eq 'NetWare' || $^O eq 'VMS') ? `type Comp.try`
+ : ($^O eq 'MacOS') ? `catenate Comp.try`
+ : `cat Comp.try`;
-
$_ = `cat Comp.try`
;
+
like($out, qr/.*\n.*\n.*\n$/)
;
-if (/.*\n.*\n.*\n$/) {print "ok 4\n";} else {print "not ok 4\n";}
-`/bin/rm -f Comp.try`;
+close(TRY) || (die "Can't close temp file.");
+
unlink 'Comp.try' ||
`/bin/rm -f Comp.try`;
-i
f ($_ eq $y) {print "ok 5\n";} else {print "not ok 5\n";}
+i
s($out, $y);