Use test.pl, not Test.pm, in t/run/*.t
[p5sagit/p5-mst-13.2.git] / t / comp / multiline.t
CommitLineData
8d063cd8 1#!./perl
2
853410bb 3BEGIN {
7bbfeec9 4 chdir 't';
5 @INC = '../lib';
6 require './test.pl';
7}
8d063cd8 8
7bbfeec9 9plan(tests => 6);
8d063cd8 10
7bbfeec9 11open(TRY,'>Comp.try') || (die "Can't open temp file.");
8d063cd8 12
13$x = 'now is the time
14for all good men
15to come to.
c6f14548 16
17
18!
19
8d063cd8 20';
21
22$y = 'now is the time' . "\n" .
23'for all good men' . "\n" .
c6f14548 24'to come to.' . "\n\n\n!\n\n";
8d063cd8 25
7bbfeec9 26is($x, $y, 'test data is sane');
8d063cd8 27
7bbfeec9 28print TRY $x;
d1e4d418 29close TRY or die "Could not close: $!";
8d063cd8 30
7bbfeec9 31open(TRY,'Comp.try') || (die "Can't reopen temp file.");
8d063cd8 32$count = 0;
33$z = '';
7bbfeec9 34while (<TRY>) {
8d063cd8 35 $z .= $_;
36 $count = $count + 1;
37}
38
7bbfeec9 39is($z, $y, 'basic multiline reading');
8d063cd8 40
7bbfeec9 41is($count, 7, ' line count');
42is($., 7, ' $.' );
8d063cd8 43
7bbfeec9 44$out = (($^O eq 'MSWin32') || $^O eq 'NetWare' || $^O eq 'VMS') ? `type Comp.try`
95e8664e 45 : ($^O eq 'MacOS') ? `catenate Comp.try`
46 : `cat Comp.try`;
8d063cd8 47
7bbfeec9 48like($out, qr/.*\n.*\n.*\n$/);
bbad3607 49
7bbfeec9 50close(TRY) || (die "Can't close temp file.");
a0d0e21e 51unlink 'Comp.try' || `/bin/rm -f Comp.try`;
8d063cd8 52
7bbfeec9 53is($out, $y);